From: Daniel Schwarz Date: Tue, 14 Nov 2017 09:42:32 +0000 (+0100) Subject: Auto-generate sonar-ws for integration tests X-Git-Tag: 7.0-RC1~313^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2803%2Fhead;p=sonarqube.git Auto-generate sonar-ws for integration tests --- diff --git a/pom.xml b/pom.xml index 4ba67554127..e73536e5ba0 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ sonar-markdown sonar-plugin-api server + sonar-ws-generated sonar-ws sonar-testing-harness plugins/sonar-xoo-plugin @@ -431,6 +432,11 @@ sonar-scanner-protocol ${project.version} + + ${project.groupId} + sonar-ws-generated + ${project.version} + ${project.groupId} sonar-ws diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java index 8b395c90518..7a3bd5e8fca 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java @@ -26,9 +26,9 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import javax.annotation.Nullable; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUserGroups; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.GroupsWsResponse.Group; +import org.sonarqube.ws.UserGroups; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.GroupsWsResponse.Group; import org.sonarqube.ws.client.user.GroupsRequest; import org.sonarqube.ws.client.usergroup.AddUserWsRequest; import org.sonarqube.ws.client.usergroup.CreateWsRequest; @@ -47,7 +47,7 @@ public class GroupTester { } @SafeVarargs - public final WsUserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer... populators) { + public final UserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer... populators) { int id = ID_GENERATOR.getAndIncrement(); CreateWsRequest.Builder request = CreateWsRequest.builder() .setName("Group" + id) @@ -62,7 +62,7 @@ public class GroupTester { .setOrganization(organization != null ? organization.getKey() : null) .setLogin(userLogin) .build(); - WsUsers.GroupsWsResponse response = session.users().service().groups(request); + Users.GroupsWsResponse response = session.users().service().groups(request); return response.getGroupsList(); } diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java index a9d098ee261..08c317c6d40 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java @@ -25,7 +25,7 @@ import java.util.function.Consumer; import javax.annotation.Nullable; import org.assertj.core.api.Assertions; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.organization.CreateWsRequest; @@ -35,7 +35,6 @@ import org.sonarqube.ws.client.organization.SearchWsRequest; import org.sonarqube.ws.client.user.GroupsRequest; import static java.util.Arrays.stream; -import static org.assertj.core.api.Assertions.assertThat; public class OrganizationTester { @@ -70,7 +69,7 @@ public class OrganizationTester { return service().create(request.build()).getOrganization(); } - public OrganizationTester addMember(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) { + public OrganizationTester addMember(Organizations.Organization organization, Users.CreateWsResponse.User user) { service().addMember(organization.getKey(), user.getLogin()); return this; } @@ -89,7 +88,7 @@ public class OrganizationTester { return this; } - public OrganizationTester assertThatMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) { + public OrganizationTester assertThatMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) { return assertThatMemberOf(organization, user.getLogin()); } @@ -99,7 +98,7 @@ public class OrganizationTester { return this; } - public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) { + public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) { return assertThatNotMemberOf(organization, user.getLogin()); } @@ -126,7 +125,7 @@ public class OrganizationTester { } private void verifyMembersGroupMembership(String userLogin, @Nullable Organizations.Organization organization, boolean isMember) { - List groups = session.wsClient().users().groups(GroupsRequest.builder() + List groups = session.wsClient().users().groups(GroupsRequest.builder() .setLogin(userLogin) .setOrganization(organization != null ? organization.getKey() : null) .setQuery("Members") diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java index 6b63e850ee2..9c48acaf47b 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java @@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import javax.annotation.Nullable; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsProjects; +import org.sonarqube.ws.Projects; import org.sonarqube.ws.client.project.CreateRequest; import org.sonarqube.ws.client.project.DeleteRequest; import org.sonarqube.ws.client.project.ProjectsService; @@ -49,7 +49,12 @@ public class ProjectTester { } @SafeVarargs - public final WsProjects.CreateWsResponse.Project generate(@Nullable Organizations.Organization organization, Consumer... populators) { + public final Projects.CreateWsResponse.Project provision(Consumer... populators) { + return provision(null, populators); + } + + @SafeVarargs + public final Projects.CreateWsResponse.Project provision(@Nullable Organizations.Organization organization, Consumer... populators) { int id = ID_GENERATOR.getAndIncrement(); CreateRequest.Builder request = CreateRequest.builder() .setKey("key" + id) diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java index e0a1f8bae53..5db54abe49f 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java @@ -24,12 +24,13 @@ import com.google.gson.annotations.SerializedName; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.qualitygate.QualityGatesService; -import org.sonarqube.ws.client.qualitygate.SelectWsRequest; +import org.sonarqube.ws.client.qualitygates.CreateRequest; +import org.sonarqube.ws.client.qualitygates.QualitygatesService; +import org.sonarqube.ws.client.qualitygates.SelectRequest; public class QGateTester { private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); @@ -40,7 +41,7 @@ public class QGateTester { this.session = session; } - public QualityGatesService service() { + public QualitygatesService service() { return session.wsClient().qualityGates(); } @@ -54,11 +55,11 @@ public class QGateTester { public CreateWsResponse generate() { int id = ID_GENERATOR.getAndIncrement(); - return session.wsClient().qualityGates().create("QualityGate" + id); + return session.wsClient().qualityGates().create(new CreateRequest().setName("QualityGate" + id)); } public void associateProject(CreateWsResponse qualityGate, Project project){ - service().associateProject(new SelectWsRequest().setGateId(qualityGate.getId()).setProjectKey(project.getKey())); + service().select(new SelectRequest().setGateId(String.valueOf(qualityGate.getId())).setProjectKey(project.getKey())); } public static class ListResponse { diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java index 2c80d28fe2c..25ac4c79602 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java @@ -25,9 +25,9 @@ import java.util.function.Consumer; import org.assertj.core.api.Assertions; import org.sonarqube.ws.Common; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile; import org.sonarqube.ws.Rules; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.qualityprofile.ActivateRuleWsRequest; import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java index 72e3cb5126e..8b38ca267a2 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java @@ -24,8 +24,8 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.user.CreateRequest; import org.sonarqube.ws.client.user.SearchRequest; @@ -122,8 +122,8 @@ public class UserTester { return session.wsClient().users(); } - public Optional getByLogin(String login) { - List users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList(); + public Optional getByLogin(String login) { + List users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList(); if (users.size() == 1) { return Optional.of(users.get(0)); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java index 939b9a46935..06fb6d5382d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java @@ -27,8 +27,8 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.scanner.protocol.input.FileData; import org.sonar.scanner.protocol.input.ProjectRepositories; -import org.sonarqube.ws.WsBatch.WsProjectResponse; -import org.sonarqube.ws.WsBatch.WsProjectResponse.FileData.Builder; +import org.sonarqube.ws.Batch.WsProjectResponse; +import org.sonarqube.ws.Batch.WsProjectResponse.FileData.Builder; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001; diff --git a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java index 078fb44ce6e..f82fe00936a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java @@ -45,7 +45,7 @@ import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsBranches; +import org.sonarqube.ws.ProjectBranches; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Collections.singletonList; @@ -112,7 +112,7 @@ public class ListAction implements BranchWsAction { .selectLastAnalysesByRootComponentUuids(dbSession, branches.stream().map(BranchDto::getUuid).collect(Collectors.toList())) .stream().collect(uniqueIndex(SnapshotDto::getComponentUuid, s -> formatDateTime(s.getCreatedAt()))); - WsBranches.ListWsResponse.Builder protobufResponse = WsBranches.ListWsResponse.newBuilder(); + ProjectBranches.ListWsResponse.Builder protobufResponse = ProjectBranches.ListWsResponse.newBuilder(); branches.stream() .forEach(b -> addBranch(protobufResponse, b, mergeBranchesByUuid, qualityGateMeasuresByComponentUuids.get(b.getUuid()), branchStatisticsByBranchUuid.get(b.getUuid()), analysisDateByBranchUuid.get(b.getUuid()))); @@ -120,9 +120,9 @@ public class ListAction implements BranchWsAction { } } - private static void addBranch(WsBranches.ListWsResponse.Builder response, BranchDto branch, Map mergeBranchesByUuid, @Nullable MeasureDto qualityGateMeasure, - BranchStatistics branchStatistics, @Nullable String analysisDate) { - WsBranches.Branch.Builder builder = toBranchBuilder(branch, Optional.ofNullable(mergeBranchesByUuid.get(branch.getMergeBranchUuid()))); + private static void addBranch(ProjectBranches.ListWsResponse.Builder response, BranchDto branch, Map mergeBranchesByUuid, + @Nullable MeasureDto qualityGateMeasure, BranchStatistics branchStatistics, @Nullable String analysisDate) { + ProjectBranches.Branch.Builder builder = toBranchBuilder(branch, Optional.ofNullable(mergeBranchesByUuid.get(branch.getMergeBranchUuid()))); setBranchStatus(builder, branch, qualityGateMeasure, branchStatistics); if (analysisDate != null) { builder.setAnalysisDate(analysisDate); @@ -130,8 +130,8 @@ public class ListAction implements BranchWsAction { response.addBranches(builder); } - private static WsBranches.Branch.Builder toBranchBuilder(BranchDto branch, Optional mergeBranch) { - WsBranches.Branch.Builder builder = WsBranches.Branch.newBuilder(); + private static ProjectBranches.Branch.Builder toBranchBuilder(BranchDto branch, Optional mergeBranch) { + ProjectBranches.Branch.Builder builder = ProjectBranches.Branch.newBuilder(); String branchKey = branch.getKey(); setNullable(branchKey, builder::setName); builder.setIsMain(branch.isMain()); @@ -147,8 +147,9 @@ public class ListAction implements BranchWsAction { return builder; } - private static void setBranchStatus(WsBranches.Branch.Builder builder, BranchDto branch, @Nullable MeasureDto qualityGateMeasure, @Nullable BranchStatistics branchStatistics) { - WsBranches.Branch.Status.Builder statusBuilder = WsBranches.Branch.Status.newBuilder(); + private static void setBranchStatus(ProjectBranches.Branch.Builder builder, BranchDto branch, @Nullable MeasureDto qualityGateMeasure, + @Nullable BranchStatistics branchStatistics) { + ProjectBranches.Branch.Status.Builder statusBuilder = ProjectBranches.Branch.Status.newBuilder(); if (branch.getBranchType() == LONG && qualityGateMeasure != null) { statusBuilder.setQualityGateStatus(qualityGateMeasure.getData()); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java index 3d2d55203ca..a3f773fc5ca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java @@ -48,10 +48,12 @@ import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentQuery; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsCe.ActivityResponse; -import org.sonarqube.ws.client.ce.ActivityWsRequest; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce.ActivityResponse; +import org.sonarqube.ws.client.ce.ActivityRequest; +import static java.lang.Boolean.parseBoolean; +import static java.lang.Integer.parseInt; import static java.lang.String.format; import static java.util.Collections.singletonList; import static org.apache.commons.lang.StringUtils.defaultString; @@ -161,32 +163,32 @@ public class ActivityAction implements CeWsAction { writeProtobuf(activityResponse, wsRequest, wsResponse); } - private ActivityResponse doHandle(ActivityWsRequest request) { + private ActivityResponse doHandle(ActivityRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto component = loadComponent(dbSession, request); checkPermission(component); // if a task searched by uuid is found all other parameters are ignored - Optional taskSearchedById = searchTaskByUuid(dbSession, request); + Optional taskSearchedById = searchTaskByUuid(dbSession, request); if (taskSearchedById.isPresent()) { return buildResponse( singletonList(taskSearchedById.get()), Collections.emptyList(), - request.getPageSize()); + parseInt(request.getPs())); } CeTaskQuery query = buildQuery(dbSession, request, component); - List queuedTasks = loadQueuedTasks(dbSession, request, query); - List pastTasks = loadPastTasks(dbSession, request, query); + List queuedTasks = loadQueuedTasks(dbSession, request, query); + List pastTasks = loadPastTasks(dbSession, request, query); return buildResponse( queuedTasks, pastTasks, - request.getPageSize()); + parseInt(request.getPs())); } } @CheckForNull - private ComponentDto loadComponent(DbSession dbSession, ActivityWsRequest request) { + private ComponentDto loadComponent(DbSession dbSession, ActivityRequest request) { String componentId = request.getComponentId(); if (componentId == null) { return null; @@ -205,8 +207,8 @@ public class ActivityAction implements CeWsAction { } } - private Optional searchTaskByUuid(DbSession dbSession, ActivityWsRequest request) { - String textQuery = request.getQuery(); + private Optional searchTaskByUuid(DbSession dbSession, ActivityRequest request) { + String textQuery = request.getQ(); if (textQuery == null) { return Optional.absent(); } @@ -220,10 +222,10 @@ public class ActivityAction implements CeWsAction { return activity.map(ceActivityDto -> Optional.of(formatter.formatActivity(dbSession, ceActivityDto, null))).orElseGet(Optional::absent); } - private CeTaskQuery buildQuery(DbSession dbSession, ActivityWsRequest request, @Nullable ComponentDto component) { + private CeTaskQuery buildQuery(DbSession dbSession, ActivityRequest request, @Nullable ComponentDto component) { CeTaskQuery query = new CeTaskQuery(); query.setType(request.getType()); - query.setOnlyCurrents(request.getOnlyCurrents()); + query.setOnlyCurrents(parseBoolean(request.getOnlyCurrents())); Date minSubmittedAt = parseStartingDateOrDateTime(request.getMinSubmittedAt()); query.setMinSubmittedAt(minSubmittedAt == null ? null : minSubmittedAt.getTime()); Date maxExecutedAt = parseEndingDateOrDateTime(request.getMaxExecutedAt()); @@ -234,7 +236,7 @@ public class ActivityAction implements CeWsAction { query.setStatuses(request.getStatus()); } - String componentQuery = request.getQuery(); + String componentQuery = request.getQ(); if (component != null) { query.setComponentUuid(component.uuid()); } else if (componentQuery != null) { @@ -251,28 +253,28 @@ public class ActivityAction implements CeWsAction { return dbClient.componentDao().selectByQuery(dbSession, componentDtoQuery, 0, CeTaskQuery.MAX_COMPONENT_UUIDS); } - private List loadQueuedTasks(DbSession dbSession, ActivityWsRequest request, CeTaskQuery query) { - List dtos = dbClient.ceQueueDao().selectByQueryInDescOrder(dbSession, query, request.getPageSize()); + private List loadQueuedTasks(DbSession dbSession, ActivityRequest request, CeTaskQuery query) { + List dtos = dbClient.ceQueueDao().selectByQueryInDescOrder(dbSession, query, parseInt(request.getPs())); return formatter.formatQueue(dbSession, dtos); } - private List loadPastTasks(DbSession dbSession, ActivityWsRequest request, CeTaskQuery query) { - List dtos = dbClient.ceActivityDao().selectByQuery(dbSession, query, forPage(1).andSize(request.getPageSize())); + private List loadPastTasks(DbSession dbSession, ActivityRequest request, CeTaskQuery query) { + List dtos = dbClient.ceActivityDao().selectByQuery(dbSession, query, forPage(1).andSize(parseInt(request.getPs()))); return formatter.formatActivity(dbSession, dtos); } - private static ActivityResponse buildResponse(Iterable queuedTasks, Iterable pastTasks, int pageSize) { - WsCe.ActivityResponse.Builder wsResponseBuilder = WsCe.ActivityResponse.newBuilder(); + private static ActivityResponse buildResponse(Iterable queuedTasks, Iterable pastTasks, int pageSize) { + Ce.ActivityResponse.Builder wsResponseBuilder = Ce.ActivityResponse.newBuilder(); int nbInsertedTasks = 0; - for (WsCe.Task queuedTask : queuedTasks) { + for (Ce.Task queuedTask : queuedTasks) { if (nbInsertedTasks < pageSize) { wsResponseBuilder.addTasks(queuedTask); nbInsertedTasks++; } } - for (WsCe.Task pastTask : pastTasks) { + for (Ce.Task pastTask : pastTasks) { if (nbInsertedTasks < pageSize) { wsResponseBuilder.addTasks(pastTask); nbInsertedTasks++; @@ -281,18 +283,18 @@ public class ActivityAction implements CeWsAction { return wsResponseBuilder.build(); } - private static ActivityWsRequest toSearchWsRequest(Request request) { - ActivityWsRequest activityWsRequest = new ActivityWsRequest() + private static ActivityRequest toSearchWsRequest(Request request) { + ActivityRequest activityWsRequest = new ActivityRequest() .setComponentId(request.param(PARAM_COMPONENT_ID)) - .setQuery(defaultString(request.param(Param.TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY))) + .setQ(defaultString(request.param(Param.TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY))) .setStatus(request.paramAsStrings(PARAM_STATUS)) .setType(request.param(PARAM_TYPE)) .setMinSubmittedAt(request.param(PARAM_MIN_SUBMITTED_AT)) .setMaxExecutedAt(request.param(PARAM_MAX_EXECUTED_AT)) - .setOnlyCurrents(request.paramAsBoolean(PARAM_ONLY_CURRENTS)) - .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)); + .setOnlyCurrents(String.valueOf(request.paramAsBoolean(PARAM_ONLY_CURRENTS))) + .setPs(String.valueOf(request.mandatoryParamAsInt(Param.PAGE_SIZE))); - checkRequest(activityWsRequest.getComponentId() == null || activityWsRequest.getQuery() == null, "%s and %s must not be set at the same time", + checkRequest(activityWsRequest.getComponentId() == null || activityWsRequest.getQ() == null, "%s and %s must not be set at the same time", PARAM_COMPONENT_ID, PARAM_COMPONENT_QUERY); return activityWsRequest; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java index aaf1ea5fa71..cbe55189827 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java @@ -34,8 +34,8 @@ import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.WsCe.ActivityStatusWsResponse; -import org.sonarqube.ws.client.ce.ActivityStatusWsRequest; +import org.sonarqube.ws.Ce.ActivityStatusWsResponse; +import org.sonarqube.ws.client.ce.ActivityStatusRequest; import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY; import static org.sonar.server.ws.WsUtils.writeProtobuf; @@ -80,7 +80,7 @@ public class ActivityStatusAction implements CeWsAction { writeProtobuf(activityStatusResponse, request, response); } - private ActivityStatusWsResponse doHandle(ActivityStatusWsRequest request) { + private ActivityStatusWsResponse doHandle(ActivityStatusRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { Optional component = searchComponent(dbSession, request); String componentUuid = component.isPresent() ? component.get().uuid() : null; @@ -97,7 +97,7 @@ public class ActivityStatusAction implements CeWsAction { } } - private Optional searchComponent(DbSession dbSession, ActivityStatusWsRequest request) { + private Optional searchComponent(DbSession dbSession, ActivityStatusRequest request) { ComponentDto component = null; if (hasComponentInRequest(request)) { component = componentFinder.getByUuidOrKey(dbSession, request.getComponentId(), request.getComponentKey(), COMPONENT_ID_AND_KEY); @@ -113,14 +113,13 @@ public class ActivityStatusAction implements CeWsAction { } } - private static boolean hasComponentInRequest(ActivityStatusWsRequest request) { + private static boolean hasComponentInRequest(ActivityStatusRequest request) { return request.getComponentId() != null || request.getComponentKey() != null; } - private static ActivityStatusWsRequest toWsRequest(Request request) { - return ActivityStatusWsRequest.newBuilder() + private static ActivityStatusRequest toWsRequest(Request request) { + return new ActivityStatusRequest() .setComponentId(request.param(PARAM_COMPONENT_ID)) - .setComponentKey(request.param(DEPRECATED_PARAM_COMPONENT_KEY)) - .build(); + .setComponentKey(request.param(DEPRECATED_PARAM_COMPONENT_KEY)); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java index 289b0cd480e..a30eefb3407 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java @@ -35,7 +35,7 @@ import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.WsCe.ProjectResponse; +import org.sonarqube.ws.Ce.ProjectResponse; import static org.sonar.db.Pagination.forPage; import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT; diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java index f00b66f0dd7..88dc9d036ce 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java @@ -31,7 +31,7 @@ import org.sonar.ce.queue.CeTask; import org.sonar.server.computation.queue.ReportSubmitter; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static org.sonar.core.component.ComponentKeys.MAX_COMPONENT_KEY_LENGTH; import static org.sonar.db.component.ComponentValidator.MAX_COMPONENT_NAME_LENGTH; @@ -116,7 +116,7 @@ public class SubmitAction implements CeWsAction { try (InputStream report = new BufferedInputStream(wsRequest.mandatoryParamAsPart(PARAM_REPORT_DATA).getInputStream())) { CeTask task = reportSubmitter.submit(organizationKey, projectKey, projectBranch, projectName, characteristics, report); - WsCe.SubmitResponse submitResponse = WsCe.SubmitResponse.newBuilder() + Ce.SubmitResponse submitResponse = Ce.SubmitResponse.newBuilder() .setTaskId(task.getUuid()) .setProjectId(task.getComponentUuid()) .build(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java index 9e809380ce7..c41e7265fb6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java @@ -42,7 +42,7 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; @@ -92,7 +92,7 @@ public class TaskAction implements CeWsAction { public void handle(Request wsRequest, Response wsResponse) throws Exception { String taskUuid = wsRequest.mandatoryParam(PARAM_TASK_UUID); try (DbSession dbSession = dbClient.openSession(false)) { - WsCe.TaskResponse.Builder wsTaskResponse = WsCe.TaskResponse.newBuilder(); + Ce.TaskResponse.Builder wsTaskResponse = Ce.TaskResponse.newBuilder(); Optional queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, taskUuid); if (queueDto.isPresent()) { com.google.common.base.Optional component = loadComponent(dbSession, queueDto.get().getComponentUuid()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java index a059c766289..d0e06adc3d5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java @@ -40,8 +40,8 @@ import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskCharacteristicDto; import org.sonar.db.component.ComponentDto; import org.sonar.db.organization.OrganizationDto; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsCe; import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; @@ -63,17 +63,17 @@ public class TaskFormatter { this.system2 = system2; } - public List formatQueue(DbSession dbSession, List dtos) { + public List formatQueue(DbSession dbSession, List dtos) { DtoCache cache = DtoCache.forQueueDtos(dbClient, dbSession, dtos); return dtos.stream().map(input -> formatQueue(input, cache)).collect(MoreCollectors.toList(dtos.size())); } - public WsCe.Task formatQueue(DbSession dbSession, CeQueueDto queue) { + public Ce.Task formatQueue(DbSession dbSession, CeQueueDto queue) { return formatQueue(queue, DtoCache.forQueueDtos(dbClient, dbSession, singletonList(queue))); } - private WsCe.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) { - WsCe.Task.Builder builder = WsCe.Task.newBuilder(); + private Ce.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) { + Ce.Task.Builder builder = Ce.Task.newBuilder(); String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid()); // FIXME organization field should be set from the CeQueueDto rather than from the ComponentDto setNullable(organizationKey, builder::setOrganization); @@ -82,7 +82,7 @@ public class TaskFormatter { setComponent(builder, dto.getComponentUuid(), componentDtoCache); } builder.setId(dto.getUuid()); - builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name())); + builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name())); builder.setType(dto.getTaskType()); builder.setLogs(false); setNullable(dto.getSubmitterLogin(), builder::setSubmitterLogin); @@ -93,24 +93,24 @@ public class TaskFormatter { return builder.build(); } - public WsCe.Task formatActivity(DbSession dbSession, CeActivityDto dto, @Nullable String scannerContext) { + public Ce.Task formatActivity(DbSession dbSession, CeActivityDto dto, @Nullable String scannerContext) { return formatActivity(dto, DtoCache.forActivityDtos(dbClient, dbSession, singletonList(dto)), scannerContext); } - public List formatActivity(DbSession dbSession, List dtos) { + public List formatActivity(DbSession dbSession, List dtos) { DtoCache cache = DtoCache.forActivityDtos(dbClient, dbSession, dtos); return dtos.stream() .map(input -> formatActivity(input, cache, null)) .collect(MoreCollectors.toList(dtos.size())); } - private static WsCe.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) { - WsCe.Task.Builder builder = WsCe.Task.newBuilder(); + private static Ce.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) { + Ce.Task.Builder builder = Ce.Task.newBuilder(); String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid()); // FIXME organization field should be set from the CeActivityDto rather than from the ComponentDto setNullable(organizationKey, builder::setOrganization); builder.setId(dto.getUuid()); - builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name())); + builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name())); builder.setType(dto.getTaskType()); builder.setLogs(false); setNullable(dto.getComponentUuid(), uuid -> setComponent(builder, uuid, componentDtoCache).setComponentId(uuid)); @@ -133,7 +133,7 @@ public class TaskFormatter { return builder.build(); } - private static WsCe.Task.Builder setComponent(WsCe.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) { + private static Ce.Task.Builder setComponent(Ce.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) { ComponentDto componentDto = componentDtoCache.getComponent(componentUuid); if (componentDto == null) { return builder; @@ -144,7 +144,7 @@ public class TaskFormatter { return builder; } - private static WsCe.Task.Builder setBranch(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) { + private static Ce.Task.Builder setBranch(Ce.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) { componentDtoCache.getBranchName(taskUuid).ifPresent( b -> { builder.setBranch(b); diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java index d4f494a32dc..b55f4ca7596 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java @@ -25,7 +25,7 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.ce.taskprocessor.CeTaskProcessor; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static org.sonar.server.ws.WsUtils.writeProtobuf; @@ -52,7 +52,7 @@ public class TaskTypesAction implements CeWsAction { @Override public void handle(Request request, Response response) throws Exception { - WsCe.TaskTypesWsResponse taskTypesWsResponse = WsCe.TaskTypesWsResponse.newBuilder() + Ce.TaskTypesWsResponse taskTypesWsResponse = Ce.TaskTypesWsResponse.newBuilder() .addAllTaskTypes(taskTypes) .build(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java index 6a25ea910f1..5d0f402bec5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java @@ -25,7 +25,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.ce.configuration.WorkerCountProvider; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsCe.WorkerCountResponse; +import org.sonarqube.ws.Ce.WorkerCountResponse; import static org.sonar.server.ws.WsUtils.writeProtobuf; import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java index a7c29b447e9..0ab0e0d43e2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java @@ -28,7 +28,7 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.project.Visibility; -import org.sonarqube.ws.WsComponents; +import org.sonarqube.ws.Components; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.emptyToNull; @@ -46,7 +46,7 @@ class ComponentDtoToWsComponent { // prevent instantiation } - static WsComponents.Component.Builder componentDtoToWsComponent(ComponentDto dto, OrganizationDto organizationDto, Optional lastAnalysis) { + static Components.Component.Builder componentDtoToWsComponent(ComponentDto dto, OrganizationDto organizationDto, Optional lastAnalysis) { checkArgument( Objects.equals(dto.getOrganizationUuid(), organizationDto.getUuid()), "OrganizationUuid (%s) of ComponentDto to convert to Ws Component is not the same as the one (%s) of the specified OrganizationDto", @@ -54,8 +54,8 @@ class ComponentDtoToWsComponent { return componentDtoToWsComponent(dto, organizationDto.getKey(), lastAnalysis); } - private static WsComponents.Component.Builder componentDtoToWsComponent(ComponentDto dto, String organizationDtoKey, Optional lastAnalysis) { - WsComponents.Component.Builder wsComponent = WsComponents.Component.newBuilder() + private static Components.Component.Builder componentDtoToWsComponent(ComponentDto dto, String organizationDtoKey, Optional lastAnalysis) { + Components.Component.Builder wsComponent = Components.Component.newBuilder() .setOrganization(organizationDtoKey) .setId(dto.uuid()) .setKey(dto.getKey()) @@ -78,7 +78,7 @@ class ComponentDtoToWsComponent { return wsComponent; } - private static void setTags(ComponentDto dto, WsComponents.Component.Builder wsComponent) { + private static void setTags(ComponentDto dto, Components.Component.Builder wsComponent) { if (Qualifiers.PROJECT.equals(dto.qualifier())) { wsComponent.getTagsBuilder().addAllTags(dto.getTags()); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java index ce509b07410..8e847517bc8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java @@ -41,8 +41,8 @@ import org.sonar.server.es.SearchIdResult; import org.sonar.server.es.SearchOptions; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.SearchWsResponse; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Components.SearchWsResponse; import org.sonarqube.ws.client.component.SearchWsRequest; import static com.google.common.base.Preconditions.checkArgument; @@ -180,13 +180,13 @@ public class SearchAction implements ComponentsWsAction { return responseBuilder.build(); } - private static WsComponents.Component dtoToComponent(OrganizationDto organization, ComponentDto dto, String projectKey) { + private static Components.Component dtoToComponent(OrganizationDto organization, ComponentDto dto, String projectKey) { checkArgument( organization.getUuid().equals(dto.getOrganizationUuid()), "No Organization found for uuid '%s'", dto.getOrganizationUuid()); - WsComponents.Component.Builder builder = WsComponents.Component.newBuilder() + Components.Component.Builder builder = Components.Component.newBuilder() .setOrganization(organization.getKey()) .setId(dto.uuid()) .setKey(dto.getDbKey()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java index 1ab654c1fd3..f114bd780c5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java @@ -56,8 +56,8 @@ import org.sonar.server.measure.index.ProjectMeasuresQuery; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; import static com.google.common.base.MoreObjects.firstNonNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java index ba38c39f408..8288af7cec1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java @@ -34,7 +34,7 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsComponents.ShowWsResponse; +import org.sonarqube.ws.Components.ShowWsResponse; import org.sonarqube.ws.client.component.ShowWsRequest; import static com.google.common.base.Preconditions.checkArgument; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java index 307587b35df..bfe7284ed74 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java @@ -56,10 +56,10 @@ import org.sonar.server.component.index.SuggestionQuery; import org.sonar.server.es.DefaultIndexSettings; import org.sonar.server.favorite.FavoriteFinder; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Category; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Project; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Suggestion; +import org.sonarqube.ws.Components.SuggestionsWsResponse; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Category; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Project; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Suggestion; import static com.google.common.base.Preconditions.checkState; import static java.util.Arrays.stream; @@ -72,8 +72,8 @@ import static org.sonar.core.util.stream.MoreCollectors.toSet; import static org.sonar.server.component.index.SuggestionQuery.DEFAULT_LIMIT; import static org.sonar.server.es.DefaultIndexSettings.MINIMUM_NGRAM_LENGTH; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Organization; -import static org.sonarqube.ws.WsComponents.SuggestionsWsResponse.newBuilder; +import static org.sonarqube.ws.Components.SuggestionsWsResponse.Organization; +import static org.sonarqube.ws.Components.SuggestionsWsResponse.newBuilder; import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SUGGESTIONS; public class SuggestionsAction implements ComponentsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java index 5108087f1e5..1bd0014c0b0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java @@ -50,8 +50,8 @@ import org.sonar.db.component.ComponentTreeQuery.Strategy; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.TreeWsResponse; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Components.TreeWsResponse; import org.sonarqube.ws.client.component.TreeWsRequest; import static com.google.common.base.Preconditions.checkArgument; @@ -233,9 +233,9 @@ public class TreeAction implements ComponentsWsAction { return response.build(); } - private static WsComponents.Component.Builder toWsComponent(ComponentDto component, OrganizationDto organizationDto, - Map referenceComponentsByUuid) { - WsComponents.Component.Builder wsComponent = componentDtoToWsComponent(component, organizationDto, Optional.empty()); + private static Components.Component.Builder toWsComponent(ComponentDto component, OrganizationDto organizationDto, + Map referenceComponentsByUuid) { + Components.Component.Builder wsComponent = componentDtoToWsComponent(component, organizationDto, Optional.empty()); ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid()); if (referenceComponent != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowResponseBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowResponseBuilder.java index b725c7b41c7..d86a0a23e33 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowResponseBuilder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowResponseBuilder.java @@ -28,9 +28,9 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDao; import org.sonar.db.component.ComponentDto; -import org.sonarqube.ws.WsDuplications; -import org.sonarqube.ws.WsDuplications.Block; -import org.sonarqube.ws.WsDuplications.ShowResponse; +import org.sonarqube.ws.Duplications; +import org.sonarqube.ws.Duplications.Block; +import org.sonarqube.ws.Duplications.ShowResponse; import static com.google.common.collect.Maps.newHashMap; import static org.sonar.core.util.Protobuf.setNullable; @@ -61,8 +61,8 @@ public class ShowResponseBuilder { return response.build(); } - private static WsDuplications.Duplication.Builder toWsDuplication(DuplicationsParser.Block block, Map refByComponentKey) { - WsDuplications.Duplication.Builder wsDuplication = WsDuplications.Duplication.newBuilder(); + private static Duplications.Duplication.Builder toWsDuplication(DuplicationsParser.Block block, Map refByComponentKey) { + Duplications.Duplication.Builder wsDuplication = Duplications.Duplication.newBuilder(); block.getDuplications().stream() .map(d -> toWsBlock(refByComponentKey, d)) .forEach(wsDuplication::addBlocks); @@ -86,8 +86,8 @@ public class ShowResponseBuilder { return block; } - private static WsDuplications.File toWsFile(ComponentDto file, @Nullable ComponentDto project, @Nullable ComponentDto subProject, @Nullable String branch) { - WsDuplications.File.Builder wsFile = WsDuplications.File.newBuilder(); + private static Duplications.File toWsFile(ComponentDto file, @Nullable ComponentDto project, @Nullable ComponentDto subProject, @Nullable String branch) { + Duplications.File.Builder wsFile = Duplications.File.newBuilder(); wsFile.setKey(file.getKey()); wsFile.setUuid(file.uuid()); wsFile.setName(file.longName()); @@ -113,7 +113,7 @@ public class ShowResponseBuilder { private void writeFiles(DbSession session, ShowResponse.Builder response, Map refByComponentKey, @Nullable String branch) { Map projectsByUuid = newHashMap(); Map parentModulesByUuid = newHashMap(); - Map filesByRef = response.getMutableFiles(); + Map filesByRef = response.getMutableFiles(); for (Map.Entry entry : refByComponentKey.entrySet()) { String componentKey = entry.getKey(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ApplyLicenseAction.java b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ApplyLicenseAction.java index cf37a01ba5a..a52922b6072 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ApplyLicenseAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/ApplyLicenseAction.java @@ -34,7 +34,7 @@ import org.sonar.server.platform.WebServer; import org.sonar.server.plugins.edition.EditionInstaller; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsEditions; +import org.sonarqube.ws.Editions; import static com.google.common.base.Preconditions.checkState; @@ -115,11 +115,11 @@ public class ApplyLicenseAction implements EditionsWsAction { } } - private WsEditions.StatusResponse buildResponse() { - WsEditions.StatusResponse.Builder builder = WsEditions.StatusResponse.newBuilder() + private Editions.StatusResponse buildResponse() { + Editions.StatusResponse.Builder builder = Editions.StatusResponse.newBuilder() .setNextEditionKey(editionManagementState.getPendingEditionKey().orElse("")) .setCurrentEditionKey(editionManagementState.getCurrentEditionKey().orElse("")) - .setInstallationStatus(WsEditions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name())); + .setInstallationStatus(Editions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name())); editionManagementState.getInstallErrorMessage().ifPresent(builder::setInstallError); return builder.build(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/FormDataAction.java b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/FormDataAction.java index 1cfb9aa100f..ca08a4b66e3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/FormDataAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/FormDataAction.java @@ -26,7 +26,7 @@ import org.sonar.api.server.ws.WebService; import org.sonar.server.measure.index.ProjectMeasuresIndex; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsEditions.FormDataResponse; +import org.sonarqube.ws.Editions.FormDataResponse; public class FormDataAction implements EditionsWsAction { private final UserSession userSession; diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/PreviewAction.java b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/PreviewAction.java index a0853f91f85..0e8e313329c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/PreviewAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/PreviewAction.java @@ -31,12 +31,12 @@ import org.sonar.server.platform.WebServer; import org.sonar.server.plugins.edition.EditionInstaller; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsEditions; +import org.sonarqube.ws.Editions; import static java.util.Optional.ofNullable; -import static org.sonarqube.ws.WsEditions.PreviewStatus.AUTOMATIC_INSTALL; -import static org.sonarqube.ws.WsEditions.PreviewStatus.MANUAL_INSTALL; -import static org.sonarqube.ws.WsEditions.PreviewStatus.NO_INSTALL; +import static org.sonarqube.ws.Editions.PreviewStatus.AUTOMATIC_INSTALL; +import static org.sonarqube.ws.Editions.PreviewStatus.MANUAL_INSTALL; +import static org.sonarqube.ws.Editions.PreviewStatus.NO_INSTALL; public class PreviewAction implements EditionsWsAction { private static final String PARAM_LICENSE = "license"; @@ -87,8 +87,8 @@ public class PreviewAction implements EditionsWsAction { WsUtils.writeProtobuf(buildResponse(nextState), request, response); } - private static WsEditions.PreviewResponse buildResponse(NextState nextState) { - return WsEditions.PreviewResponse.newBuilder() + private static Editions.PreviewResponse buildResponse(NextState nextState) { + return Editions.PreviewResponse.newBuilder() .setNextEditionKey(nextState.getPendingEditionKey().orElse("")) .setPreviewStatus(nextState.getPreviewStatus()) .build(); @@ -108,9 +108,9 @@ public class PreviewAction implements EditionsWsAction { private static final class NextState { private final String pendingEditionKey; - private final WsEditions.PreviewStatus previewStatus; + private final Editions.PreviewStatus previewStatus; - private NextState(@Nullable String pendingEditionKey, WsEditions.PreviewStatus previewStatus) { + private NextState(@Nullable String pendingEditionKey, Editions.PreviewStatus previewStatus) { this.pendingEditionKey = pendingEditionKey; this.previewStatus = previewStatus; } @@ -119,7 +119,7 @@ public class PreviewAction implements EditionsWsAction { return ofNullable(pendingEditionKey); } - WsEditions.PreviewStatus getPreviewStatus() { + Editions.PreviewStatus getPreviewStatus() { return previewStatus; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/StatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/StatusAction.java index 604d964c7dc..72d136fb590 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/edition/ws/StatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/edition/ws/StatusAction.java @@ -25,7 +25,7 @@ import org.sonar.api.server.ws.WebService; import org.sonar.server.edition.EditionManagementState; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsEditions; +import org.sonarqube.ws.Editions; public class StatusAction implements EditionsWsAction { private final UserSession userSession; @@ -52,10 +52,10 @@ public class StatusAction implements EditionsWsAction { .checkLoggedIn() .checkIsSystemAdministrator(); - WsEditions.StatusResponse.Builder responseBuilder = WsEditions.StatusResponse.newBuilder() + Editions.StatusResponse.Builder responseBuilder = Editions.StatusResponse.newBuilder() .setCurrentEditionKey(editionManagementState.getCurrentEditionKey().orElse("")) .setNextEditionKey(editionManagementState.getPendingEditionKey().orElse("")) - .setInstallationStatus(WsEditions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name())); + .setInstallationStatus(Editions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name())); editionManagementState.getInstallErrorMessage().ifPresent(responseBuilder::setInstallError); WsUtils.writeProtobuf(responseBuilder.build(), request, response); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java index a23e33014e6..03a8edd8eb7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java @@ -51,8 +51,8 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.measure.ws.MetricDtoWithBestValue.MetricDtoToMetricDtoWithBestValueFunction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.ComponentWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.ComponentWsResponse; import org.sonarqube.ws.client.measure.ComponentWsRequest; import static com.google.common.base.Preconditions.checkArgument; @@ -146,7 +146,7 @@ public class ComponentAction implements MeasuresWsAction { checkPermissions(component); SnapshotDto analysis = dbClient.snapshotDao().selectLastAnalysisByRootComponentUuid(dbSession, component.projectUuid()).orElse(null); List metrics = searchMetrics(dbSession, request); - List periods = snapshotToWsPeriods(analysis); + List periods = snapshotToWsPeriods(analysis); List measures = searchMeasures(dbSession, component, analysis, metrics, developerId); return buildResponse(request, component, refComponent, measures, metrics, periods); @@ -181,7 +181,7 @@ public class ComponentAction implements MeasuresWsAction { } private static ComponentWsResponse buildResponse(ComponentWsRequest request, ComponentDto component, Optional refComponent, List measures, - List metrics, List periods) { + List metrics, List periods) { ComponentWsResponse.Builder response = ComponentWsResponse.newBuilder(); Map metricsById = Maps.uniqueIndex(metrics, MetricDto::getId); Map measuresByMetric = new HashMap<>(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java index 3129de298a3..959d707acdf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java @@ -24,8 +24,8 @@ import org.sonar.core.util.Protobuf; import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Component; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Component; class ComponentDtoToWsComponent { private ComponentDtoToWsComponent() { @@ -42,7 +42,7 @@ class ComponentDtoToWsComponent { wsComponent.setRefKey(referenceComponent.getDbKey()); } - WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder(); + Measures.Measure.Builder measureBuilder = Measures.Measure.newBuilder(); for (Map.Entry entry : measuresByMetric.entrySet()) { MeasureDtoToWsMeasure.updateMeasureBuilder(measureBuilder, entry.getKey(), entry.getValue()); wsComponent.addMeasures(measureBuilder); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java index 10b5f566fd8..2423e61ee2f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java @@ -38,8 +38,8 @@ import org.sonar.api.utils.Paging; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTreeQuery.Strategy; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; import static com.google.common.base.Preconditions.checkArgument; @@ -256,7 +256,7 @@ public class ComponentTreeAction implements MeasuresWsAction { } if (areMetricsInResponse(request)) { - WsMeasures.Metrics.Builder metricsBuilder = response.getMetricsBuilder(); + Measures.Metrics.Builder metricsBuilder = response.getMetricsBuilder(); for (MetricDto metricDto : data.getMetrics()) { metricsBuilder.addMetrics(metricDtoToWsMetric(metricDto)); } @@ -326,15 +326,15 @@ public class ComponentTreeAction implements MeasuresWsAction { return componentTreeWsRequest; } - private static WsMeasures.Component.Builder toWsComponent(ComponentDto component, Map measures, - Map referenceComponentsByUuid) { - WsMeasures.Component.Builder wsComponent = componentDtoToWsComponent(component); + private static Measures.Component.Builder toWsComponent(ComponentDto component, Map measures, + Map referenceComponentsByUuid) { + Measures.Component.Builder wsComponent = componentDtoToWsComponent(component); ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid()); if (referenceComponent != null) { wsComponent.setRefId(referenceComponent.uuid()); wsComponent.setRefKey(referenceComponent.getDbKey()); } - WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder(); + Measures.Measure.Builder measureBuilder = Measures.Measure.newBuilder(); for (Map.Entry entry : measures.entrySet()) { ComponentTreeData.Measure measure = entry.getValue(); updateMeasureBuilder(measureBuilder, entry.getKey(), measure.getValue(), measure.getData(), measure.getVariation()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java index 5aa59590dfa..16a7d522dbc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java @@ -27,7 +27,7 @@ import javax.annotation.Nullable; import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import static java.lang.Double.NaN; import static java.lang.Double.isNaN; @@ -39,7 +39,7 @@ class ComponentTreeData { private final int componentCount; private final Map referenceComponentsByUuid; private final List metrics; - private final List periods; + private final List periods; private final Table measuresByComponentUuidAndMetric; private ComponentTreeData(Builder builder) { @@ -77,7 +77,7 @@ class ComponentTreeData { } @CheckForNull - List getPeriods() { + List getPeriods() { return periods; } @@ -96,7 +96,7 @@ class ComponentTreeData { private Map referenceComponentsByUuid; private int componentCount; private List metrics; - private List periods; + private List periods; private Table measuresByComponentUuidAndMetric; private Builder() { @@ -123,7 +123,7 @@ class ComponentTreeData { return this; } - public Builder setPeriods(List periods) { + public Builder setPeriods(List periods) { this.periods = periods; return this; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasure.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasure.java index 50cc2d5b980..3764c46b903 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasure.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasure.java @@ -22,8 +22,8 @@ package org.sonar.server.measure.ws; import javax.annotation.Nullable; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Measure; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Measure; import static org.sonar.server.measure.ws.MeasureValueFormatter.formatMeasureValue; import static org.sonar.server.measure.ws.MeasureValueFormatter.formatNumericalValue; @@ -47,7 +47,7 @@ class MeasureDtoToWsMeasure { measureBuilder.setValue(formatMeasureValue(doubleValue, stringValue, metric)); } - WsMeasures.PeriodValue.Builder periodBuilder = WsMeasures.PeriodValue.newBuilder(); + Measures.PeriodValue.Builder periodBuilder = Measures.PeriodValue.newBuilder(); if (Double.isNaN(variation)) { return; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java index 88ec4dc255f..27672b442e4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java @@ -37,8 +37,8 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsMeasures.Measure; -import org.sonarqube.ws.WsMeasures.SearchWsResponse; +import org.sonarqube.ws.Measures.Measure; +import org.sonarqube.ws.Measures.SearchWsResponse; import org.sonarqube.ws.client.measure.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java index d9adb3dbd0f..f2e4ac95748 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java @@ -44,7 +44,7 @@ import org.sonar.db.metric.MetricDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse; import org.sonarqube.ws.client.measure.SearchHistoryRequest; import static java.lang.String.format; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryResponseFactory.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryResponseFactory.java index 187e899508d..0934e64f17e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryResponseFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryResponseFactory.java @@ -29,9 +29,9 @@ import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.component.SnapshotDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryMeasure; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue; +import org.sonarqube.ws.Measures.SearchHistoryResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryMeasure; +import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue; import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.server.measure.ws.MeasureValueFormatter.formatMeasureValue; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SnapshotDtoToWsPeriods.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SnapshotDtoToWsPeriods.java index ee874b89978..a902387b981 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SnapshotDtoToWsPeriods.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/SnapshotDtoToWsPeriods.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; import org.sonar.db.component.SnapshotDto; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import static java.util.Collections.emptyList; import static org.sonar.api.utils.DateUtils.formatDateTime; @@ -33,12 +33,12 @@ class SnapshotDtoToWsPeriods { // prevent instantiation } - static List snapshotToWsPeriods(@Nullable SnapshotDto snapshot) { + static List snapshotToWsPeriods(@Nullable SnapshotDto snapshot) { if (snapshot == null) { return emptyList(); } - List periods = new ArrayList<>(); + List periods = new ArrayList<>(); if (snapshot.getPeriodDate() != null) { periods.add(snapshotDtoToWsPeriod(snapshot)); } @@ -46,8 +46,8 @@ class SnapshotDtoToWsPeriods { return periods; } - private static WsMeasures.Period snapshotDtoToWsPeriod(SnapshotDto snapshot) { - WsMeasures.Period.Builder period = WsMeasures.Period.newBuilder(); + private static Measures.Period snapshotDtoToWsPeriod(SnapshotDto snapshot) { + Measures.Period.Builder period = Measures.Period.newBuilder(); period.setIndex(1); String periodMode = snapshot.getPeriodMode(); if (periodMode != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java index 27077a53d97..4259bd4adc3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java @@ -40,8 +40,8 @@ import org.sonar.db.permission.PermissionQuery; import org.sonar.db.user.GroupDto; import org.sonar.server.permission.ProjectId; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions.Group; -import org.sonarqube.ws.WsPermissions.WsGroupsResponse; +import org.sonarqube.ws.Permissions.Group; +import org.sonarqube.ws.Permissions.WsGroupsResponse; import static java.util.Collections.emptyList; import static org.sonar.core.util.Protobuf.setNullable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchGlobalPermissionsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchGlobalPermissionsAction.java index 5104cfbb841..260601f7eac 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchGlobalPermissionsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchGlobalPermissionsAction.java @@ -30,13 +30,13 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.db.permission.OrganizationPermission; import org.sonar.db.permission.PermissionQuery; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions.Permission; -import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse; +import org.sonarqube.ws.Permissions.Permission; +import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createOrganizationParameter; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsPermissions.Permission.newBuilder; +import static org.sonarqube.ws.Permissions.Permission.newBuilder; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ORGANIZATION; public class SearchGlobalPermissionsAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java index 83adbbed00b..1782ae1ef81 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java @@ -36,9 +36,9 @@ import org.sonar.server.permission.PermissionPrivilegeChecker; import org.sonar.server.permission.ProjectId; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsPermissions.Permission; -import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse; -import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse.Project; +import org.sonarqube.ws.Permissions.Permission; +import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse; +import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse.Project; import org.sonarqube.ws.client.permission.SearchProjectPermissionsWsRequest; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java index 40d4946820f..24f6e992dcc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java @@ -39,8 +39,8 @@ import org.sonar.db.user.UserDto; import org.sonar.server.issue.ws.AvatarResolver; import org.sonar.server.permission.ProjectId; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.UsersWsResponse; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.UsersWsResponse; import static com.google.common.base.Strings.emptyToNull; import static java.util.Collections.emptyList; @@ -146,7 +146,7 @@ public class UsersAction implements PermissionsWsAction { UsersWsResponse.Builder response = UsersWsResponse.newBuilder(); users.forEach(user -> { - WsPermissions.User.Builder userResponse = response.addUsersBuilder() + Permissions.User.Builder userResponse = response.addUsersBuilder() .setLogin(user.getLogin()) .addAllPermissions(permissionsByUserId.get(user.getId())); setNullable(user.getEmail(), userResponse::setEmail); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java index 6ba87c03a46..91ba4eaf243 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java @@ -32,8 +32,8 @@ import org.sonar.db.permission.template.PermissionTemplateDto; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; -import org.sonarqube.ws.WsPermissions.PermissionTemplate; +import org.sonarqube.ws.Permissions.CreateTemplateWsResponse; +import org.sonarqube.ws.Permissions.PermissionTemplate; import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; import static java.lang.String.format; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/PermissionTemplateDtoToPermissionTemplateResponse.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/PermissionTemplateDtoToPermissionTemplateResponse.java index dfee13143f1..d0cb6b8d490 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/PermissionTemplateDtoToPermissionTemplateResponse.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/PermissionTemplateDtoToPermissionTemplateResponse.java @@ -23,7 +23,7 @@ import com.google.common.base.Function; import javax.annotation.Nonnull; import org.sonar.api.utils.DateUtils; import org.sonar.db.permission.template.PermissionTemplateDto; -import org.sonarqube.ws.WsPermissions.PermissionTemplate; +import org.sonarqube.ws.Permissions.PermissionTemplate; import static org.sonar.core.util.Protobuf.setNullable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java index a07dfe369f7..87266ae544e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java @@ -34,11 +34,11 @@ import org.sonar.db.permission.template.PermissionTemplateDto; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.Permission; -import org.sonarqube.ws.WsPermissions.PermissionTemplate; -import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse; -import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse.TemplateIdQualifier; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.Permission; +import org.sonarqube.ws.Permissions.PermissionTemplate; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse.TemplateIdQualifier; import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; import static org.sonar.api.utils.DateUtils.formatDateTime; @@ -109,7 +109,7 @@ public class SearchTemplatesAction implements PermissionsWsAction { .setTemplateId(viewDefaultTemplate))); } - private static void buildTemplatesResponse(WsPermissions.SearchTemplatesWsResponse.Builder response, SearchTemplatesData data) { + private static void buildTemplatesResponse(Permissions.SearchTemplatesWsResponse.Builder response, SearchTemplatesData data) { Permission.Builder permissionResponse = Permission.newBuilder(); PermissionTemplate.Builder templateBuilder = PermissionTemplate.newBuilder(); @@ -135,7 +135,7 @@ public class SearchTemplatesAction implements PermissionsWsAction { } } - private WsPermissions.SearchTemplatesWsResponse buildResponse(SearchTemplatesData data) { + private Permissions.SearchTemplatesWsResponse buildResponse(SearchTemplatesData data) { SearchTemplatesWsResponse.Builder response = SearchTemplatesWsResponse.newBuilder(); buildTemplatesResponse(response, data); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java index 44c44ce2655..ab2ec105106 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java @@ -38,7 +38,7 @@ import org.sonar.db.user.GroupDto; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.Permissions; import static org.sonar.api.server.ws.WebService.Param.PAGE; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; @@ -99,7 +99,7 @@ public class TemplateGroupsAction implements PermissionsWsAction { Paging paging = Paging.forPageIndex(wsRequest.mandatoryParamAsInt(PAGE)).withPageSize(wsRequest.mandatoryParamAsInt(PAGE_SIZE)).andTotal(total); List groups = findGroups(dbSession, query, template); List groupPermissions = findGroupPermissions(dbSession, groups, template); - WsPermissions.WsGroupsResponse groupsResponse = buildResponse(groups, groupPermissions, paging); + Permissions.WsGroupsResponse groupsResponse = buildResponse(groups, groupPermissions, paging); writeProtobuf(groupsResponse, wsRequest, wsResponse); } } @@ -119,13 +119,13 @@ public class TemplateGroupsAction implements PermissionsWsAction { return permissionQuery.build(); } - private static WsPermissions.WsGroupsResponse buildResponse(List groups, List groupPermissions, Paging paging) { + private static Permissions.WsGroupsResponse buildResponse(List groups, List groupPermissions, Paging paging) { Multimap permissionsByGroupId = TreeMultimap.create(); groupPermissions.forEach(groupPermission -> permissionsByGroupId.put(groupPermission.getGroupId(), groupPermission.getPermission())); - WsPermissions.WsGroupsResponse.Builder response = WsPermissions.WsGroupsResponse.newBuilder(); + Permissions.WsGroupsResponse.Builder response = Permissions.WsGroupsResponse.newBuilder(); groups.forEach(group -> { - WsPermissions.Group.Builder wsGroup = response.addGroupsBuilder() + Permissions.Group.Builder wsGroup = response.addGroupsBuilder() .setName(group.getName()); if (group.getId() != 0) { wsGroup.setId(String.valueOf(group.getId())); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java index ce703cbd3d5..4535e837be0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java @@ -39,8 +39,8 @@ import org.sonar.server.issue.ws.AvatarResolver; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.UsersWsResponse; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.UsersWsResponse; import static com.google.common.base.Strings.emptyToNull; import static org.sonar.api.server.ws.WebService.Param.PAGE; @@ -106,7 +106,7 @@ public class TemplateUsersAction implements PermissionsWsAction { List users = findUsers(dbSession, query, template); List permissionTemplateUsers = dbClient.permissionTemplateDao().selectUserPermissionsByTemplateIdAndUserLogins(dbSession, template.getId(), users.stream().map(UserDto::getLogin).collect(Collectors.toList())); - WsPermissions.UsersWsResponse templateUsersResponse = buildResponse(users, permissionTemplateUsers, paging); + Permissions.UsersWsResponse templateUsersResponse = buildResponse(users, permissionTemplateUsers, paging); writeProtobuf(templateUsersResponse, wsRequest, wsResponse); } } @@ -127,13 +127,13 @@ public class TemplateUsersAction implements PermissionsWsAction { return query.build(); } - private WsPermissions.UsersWsResponse buildResponse(List users, List permissionTemplateUsers, Paging paging) { + private Permissions.UsersWsResponse buildResponse(List users, List permissionTemplateUsers, Paging paging) { Multimap permissionsByUserId = TreeMultimap.create(); permissionTemplateUsers.forEach(userPermission -> permissionsByUserId.put(userPermission.getUserId(), userPermission.getPermission())); UsersWsResponse.Builder responseBuilder = UsersWsResponse.newBuilder(); users.forEach(user -> { - WsPermissions.User.Builder userResponse = responseBuilder.addUsersBuilder() + Permissions.User.Builder userResponse = responseBuilder.addUsersBuilder() .setLogin(user.getLogin()) .addAllPermissions(permissionsByUserId.get(user.getId())); setNullable(user.getEmail(), userResponse::setEmail); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/UpdateTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/UpdateTemplateAction.java index 95477b15f8c..b2a38561c75 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/UpdateTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/UpdateTemplateAction.java @@ -31,8 +31,8 @@ import org.sonar.db.permission.template.PermissionTemplateDto; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsPermissions.PermissionTemplate; -import org.sonarqube.ws.WsPermissions.UpdateTemplateWsResponse; +import org.sonarqube.ws.Permissions.PermissionTemplate; +import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; import org.sonarqube.ws.client.permission.UpdateTemplateWsRequest; import static com.google.common.base.MoreObjects.firstNonNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/HealthActionSupport.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/HealthActionSupport.java index 40b283b1ab7..ce9d79125cb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/HealthActionSupport.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/HealthActionSupport.java @@ -27,7 +27,7 @@ import org.sonar.process.cluster.health.NodeHealth; import org.sonar.server.health.ClusterHealth; import org.sonar.server.health.Health; import org.sonar.server.health.HealthChecker; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import static org.sonar.api.utils.DateUtils.formatDateTime; @@ -58,31 +58,31 @@ public class HealthActionSupport { .setHandler(handler); } - WsSystem.HealthResponse checkNodeHealth() { + System.HealthResponse checkNodeHealth() { Health check = healthChecker.checkNode(); - WsSystem.HealthResponse.Builder responseBuilder = WsSystem.HealthResponse.newBuilder() - .setHealth(WsSystem.Health.valueOf(check.getStatus().name())); - WsSystem.Cause.Builder causeBuilder = WsSystem.Cause.newBuilder(); + System.HealthResponse.Builder responseBuilder = System.HealthResponse.newBuilder() + .setHealth(System.Health.valueOf(check.getStatus().name())); + System.Cause.Builder causeBuilder = System.Cause.newBuilder(); check.getCauses().forEach(str -> responseBuilder.addCauses(causeBuilder.clear().setMessage(str).build())); return responseBuilder.build(); } - WsSystem.HealthResponse checkClusterHealth() { + System.HealthResponse checkClusterHealth() { ClusterHealth check = healthChecker.checkCluster(); return toResponse(check); } - private static WsSystem.HealthResponse toResponse(ClusterHealth check) { - WsSystem.HealthResponse.Builder responseBuilder = WsSystem.HealthResponse.newBuilder(); - WsSystem.Node.Builder nodeBuilder = WsSystem.Node.newBuilder(); - WsSystem.Cause.Builder causeBuilder = WsSystem.Cause.newBuilder(); + private static System.HealthResponse toResponse(ClusterHealth check) { + System.HealthResponse.Builder responseBuilder = System.HealthResponse.newBuilder(); + System.Node.Builder nodeBuilder = System.Node.newBuilder(); + System.Cause.Builder causeBuilder = System.Cause.newBuilder(); Health health = check.getHealth(); - responseBuilder.setHealth(WsSystem.Health.valueOf(health.getStatus().name())); + responseBuilder.setHealth(System.Health.valueOf(health.getStatus().name())); health.getCauses().forEach(str -> responseBuilder.addCauses(toCause(str, causeBuilder))); - WsSystem.Nodes.Builder nodesBuilder = WsSystem.Nodes.newBuilder(); + System.Nodes.Builder nodesBuilder = System.Nodes.newBuilder(); check.getNodes().stream() .sorted(NODE_HEALTH_COMPARATOR) .map(node -> toNode(node, nodeBuilder, causeBuilder)) @@ -92,13 +92,13 @@ public class HealthActionSupport { return responseBuilder.build(); } - private static WsSystem.Node toNode(NodeHealth nodeHealth, WsSystem.Node.Builder nodeBuilder, WsSystem.Cause.Builder causeBuilder) { + private static System.Node toNode(NodeHealth nodeHealth, System.Node.Builder nodeBuilder, System.Cause.Builder causeBuilder) { nodeBuilder.clear(); - nodeBuilder.setHealth(WsSystem.Health.valueOf(nodeHealth.getStatus().name())); + nodeBuilder.setHealth(System.Health.valueOf(nodeHealth.getStatus().name())); nodeHealth.getCauses().forEach(str -> nodeBuilder.addCauses(toCause(str, causeBuilder))); NodeDetails details = nodeHealth.getDetails(); nodeBuilder - .setType(WsSystem.NodeType.valueOf(details.getType().name())) + .setType(System.NodeType.valueOf(details.getType().name())) .setName(details.getName()) .setHost(details.getHost()) .setPort(details.getPort()) @@ -106,7 +106,7 @@ public class HealthActionSupport { return nodeBuilder.build(); } - private static WsSystem.Cause toCause(String str, WsSystem.Cause.Builder causeBuilder) { + private static System.Cause toCause(String str, System.Cause.Builder causeBuilder) { return causeBuilder.clear().setMessage(str).build(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/StatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/StatusAction.java index 8b29e653191..7be23b4bf08 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/StatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/StatusAction.java @@ -29,7 +29,7 @@ import org.sonar.server.app.RestartFlagHolder; import org.sonar.server.platform.Platform; import org.sonar.server.platform.db.migration.DatabaseMigrationState; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; /** * Implementation of the {@code status} action for the System WebService. @@ -73,22 +73,22 @@ public class StatusAction implements SystemWsAction { @Override public void handle(Request request, Response response) throws Exception { - WsSystem.StatusResponse.Builder protobuf = WsSystem.StatusResponse.newBuilder(); + System.StatusResponse.Builder protobuf = System.StatusResponse.newBuilder(); Protobuf.setNullable(server.getId(), protobuf::setId); Protobuf.setNullable(server.getVersion(), protobuf::setVersion); protobuf.setStatus(computeStatus()); WsUtils.writeProtobuf(protobuf.build(), request, response); } - private WsSystem.Status computeStatus() { + private System.Status computeStatus() { Platform.Status platformStatus = platform.status(); switch (platformStatus) { case BOOTING: // can not happen since there can not even exist an instance of the current class // unless the Platform's status is UP/SAFEMODE/STARTING - return WsSystem.Status.DOWN; + return System.Status.DOWN; case UP: - return restartFlagHolder.isRestarting() ? WsSystem.Status.RESTARTING : WsSystem.Status.UP; + return restartFlagHolder.isRestarting() ? System.Status.RESTARTING : System.Status.UP; case STARTING: return computeStatusInStarting(); case SAFEMODE: @@ -98,34 +98,34 @@ public class StatusAction implements SystemWsAction { } } - private WsSystem.Status computeStatusInStarting() { + private System.Status computeStatusInStarting() { DatabaseMigrationState.Status databaseMigrationStatus = migrationState.getStatus(); switch (databaseMigrationStatus) { case NONE: - return WsSystem.Status.STARTING; + return System.Status.STARTING; case RUNNING: - return WsSystem.Status.DB_MIGRATION_RUNNING; + return System.Status.DB_MIGRATION_RUNNING; case FAILED: - return WsSystem.Status.DOWN; + return System.Status.DOWN; case SUCCEEDED: // DB migration can be finished while we haven't yet finished SQ's initialization - return WsSystem.Status.STARTING; + return System.Status.STARTING; default: throw new IllegalArgumentException("Unsupported DatabaseMigration.Status " + databaseMigrationStatus); } } - private WsSystem.Status computeStatusInSafemode() { + private System.Status computeStatusInSafemode() { DatabaseMigrationState.Status databaseMigrationStatus = migrationState.getStatus(); switch (databaseMigrationStatus) { case NONE: - return WsSystem.Status.DB_MIGRATION_NEEDED; + return System.Status.DB_MIGRATION_NEEDED; case RUNNING: - return WsSystem.Status.DB_MIGRATION_RUNNING; + return System.Status.DB_MIGRATION_RUNNING; case FAILED: - return WsSystem.Status.DOWN; + return System.Status.DOWN; case SUCCEEDED: - return WsSystem.Status.STARTING; + return System.Status.STARTING; default: throw new IllegalArgumentException("Unsupported DatabaseMigration.Status " + databaseMigrationStatus); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java index 017a6ec373b..9eefaa3f91b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java @@ -35,7 +35,7 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.component.ComponentService; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse; import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/CreateAction.java index 56e8d823332..b643a9ab5c8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/CreateAction.java @@ -30,7 +30,7 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.server.component.ComponentUpdater; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjects.CreateWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse; import org.sonarqube.ws.client.project.CreateRequest; import static org.sonar.api.resources.Qualifiers.PROJECT; diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java index a5fcf853663..5597c6678ff 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java @@ -39,8 +39,8 @@ import org.sonar.db.component.ComponentQuery; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Common.Paging; -import org.sonarqube.ws.WsComponents.ProvisionedWsResponse; -import org.sonarqube.ws.WsComponents.ProvisionedWsResponse.Component; +import org.sonarqube.ws.Components.ProvisionedWsResponse; +import org.sonarqube.ws.Components.ProvisionedWsResponse.Component; import static com.google.common.collect.Sets.newHashSet; import static java.util.Optional.ofNullable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java index 03a235e2c61..f9f1dab3ee1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java @@ -39,7 +39,7 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjects.SearchWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse; import org.sonarqube.ws.client.project.SearchWsRequest; import static com.google.common.base.Preconditions.checkArgument; @@ -56,8 +56,8 @@ import static org.sonar.server.project.Visibility.PUBLIC; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_002; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsProjects.SearchWsResponse.Component; -import static org.sonarqube.ws.WsProjects.SearchWsResponse.newBuilder; +import static org.sonarqube.ws.Projects.SearchWsResponse.Component; +import static org.sonarqube.ws.Projects.SearchWsResponse.newBuilder; import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_SEARCH; import static org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZED_BEFORE; diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java index a3e07082fc2..95aabe985bd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java @@ -30,9 +30,9 @@ import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentLinkDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse; -import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Link; -import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Project; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Link; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Project; import org.sonarqube.ws.client.project.SearchMyProjectsRequest; import static com.google.common.base.Strings.emptyToNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java index 407624f6e73..69fec71a4c8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java @@ -29,8 +29,8 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentLinkDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjectLinks; -import org.sonarqube.ws.WsProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks; +import org.sonarqube.ws.ProjectLinks.CreateWsResponse; import org.sonarqube.ws.client.projectlinks.CreateWsRequest; import static org.sonar.core.util.Slug.slugify; @@ -119,7 +119,7 @@ public class CreateAction implements ProjectLinksWsAction { } private static CreateWsResponse buildResponse(ComponentLinkDto link) { - return CreateWsResponse.newBuilder().setLink(WsProjectLinks.Link.newBuilder() + return CreateWsResponse.newBuilder().setLink(ProjectLinks.Link.newBuilder() .setId(String.valueOf(link.getId())) .setName(link.getName()) .setType(link.getType()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java index bb9411b0a93..4a66a049295 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java @@ -31,8 +31,8 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentLinkDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsProjectLinks.Link; -import org.sonarqube.ws.WsProjectLinks.SearchWsResponse; +import org.sonarqube.ws.ProjectLinks.Link; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; import org.sonarqube.ws.client.projectlinks.SearchWsRequest; import static org.sonar.core.util.Protobuf.setNullable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/projecttag/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/projecttag/ws/SearchAction.java index 2300eaf507c..087ab31baaa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projecttag/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projecttag/ws/SearchAction.java @@ -25,7 +25,7 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.measure.index.ProjectMeasuresIndex; -import org.sonarqube.ws.WsProjectTags; +import org.sonarqube.ws.ProjectTags; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; @@ -52,12 +52,12 @@ public class SearchAction implements ProjectTagsWsAction { @Override public void handle(Request request, Response response) throws Exception { - WsProjectTags.SearchResponse wsResponse = doHandle(request); + ProjectTags.SearchResponse wsResponse = doHandle(request); writeProtobuf(wsResponse, request, response); } - private WsProjectTags.SearchResponse doHandle(Request request) { + private ProjectTags.SearchResponse doHandle(Request request) { List tags = index.searchTags(request.param(TEXT_QUERY), request.mandatoryParamAsInt(PAGE_SIZE)); - return WsProjectTags.SearchResponse.newBuilder().addAllTags(tags).build(); + return ProjectTags.SearchResponse.newBuilder().addAllTags(tags).build(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java index 324611084cf..f24c9bb7ecf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java @@ -30,13 +30,13 @@ import org.sonar.db.metric.MetricDto; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsQualityGates.AppWsResponse.Metric; +import org.sonarqube.ws.Qualitygates.AppWsResponse.Metric; import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY; import static org.sonar.api.measures.Metric.ValueType.RATING; import static org.sonar.server.qualitygate.ValidRatingMetrics.isCoreRatingMetric; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsQualityGates.AppWsResponse; +import static org.sonarqube.ws.Qualitygates.AppWsResponse; public class AppAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java index 0bcecbe7a80..e188f654036 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java @@ -29,7 +29,7 @@ import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.qualitygate.QualityGateUpdater; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; import static org.sonar.server.ws.WsUtils.writeProtobuf; import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java index e63722b4354..14361803e3f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java @@ -29,8 +29,7 @@ import org.sonar.db.qualitygate.QualityGateConditionDto; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.qualitygate.QualityGateConditionsUpdater; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; +import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams; @@ -80,40 +79,26 @@ public class CreateConditionAction implements QualityGatesWsAction { public void handle(Request request, Response response) { userSession.checkPermission(OrganizationPermission.ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid()); + int gateId = request.mandatoryParamAsInt(PARAM_GATE_ID); + String metric = request.mandatoryParam(PARAM_METRIC); + String operator = request.mandatoryParam(PARAM_OPERATOR); + String warning = request.param(PARAM_WARNING); + String error = request.param(PARAM_ERROR); + Integer period = request.paramAsInt(PARAM_PERIOD); + try (DbSession dbSession = dbClient.openSession(false)) { - writeProtobuf(doHandle(toWsRequest(request), dbSession), request, response); + QualityGateConditionDto condition = qualityGateConditionsUpdater.createCondition(dbSession, gateId, metric, operator, warning, error, period); + + CreateConditionWsResponse.Builder createConditionWsResponse = CreateConditionWsResponse.newBuilder() + .setId(condition.getId()) + .setMetric(condition.getMetricKey()) + .setOp(condition.getOperator()); + setNullable(condition.getWarningThreshold(), createConditionWsResponse::setWarning); + setNullable(condition.getErrorThreshold(), createConditionWsResponse::setError); + setNullable(condition.getPeriod(), createConditionWsResponse::setPeriod); + writeProtobuf(createConditionWsResponse.build(), request, response); dbSession.commit(); } } - private CreateConditionWsResponse doHandle(CreateConditionRequest request, DbSession dbSession) { - QualityGateConditionDto condition = qualityGateConditionsUpdater.createCondition(dbSession, - request.getQualityGateId(), - request.getMetricKey(), - request.getOperator(), - request.getWarning(), - request.getError(), - request.getPeriod()); - - CreateConditionWsResponse.Builder response = CreateConditionWsResponse.newBuilder() - .setId(condition.getId()) - .setMetric(condition.getMetricKey()) - .setOp(condition.getOperator()); - setNullable(condition.getWarningThreshold(), response::setWarning); - setNullable(condition.getErrorThreshold(), response::setError); - setNullable(condition.getPeriod(), response::setPeriod); - return response.build(); - } - - private static CreateConditionRequest toWsRequest(Request request) { - return CreateConditionRequest.builder() - .setQualityGateId(request.mandatoryParamAsInt(PARAM_GATE_ID)) - .setMetricKey(request.mandatoryParam(PARAM_METRIC)) - .setOperator(request.mandatoryParam(PARAM_OPERATOR)) - .setWarning(request.param(PARAM_WARNING)) - .setError(request.param(PARAM_ERROR)) - .setPeriod(request.paramAsInt(PARAM_PERIOD)) - .build(); - } - } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java index abcfee22a4d..5a6af960e6b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java @@ -33,7 +33,7 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.qualitygate.QualityGateFinder; import org.sonar.server.qualitygate.QualityGateFinder.QualityGateData; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsQualityGates.GetByProjectWsResponse; +import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java index e8838d5769a..ab79a97b456 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java @@ -42,8 +42,7 @@ import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; import static com.google.common.base.Strings.isNullOrEmpty; import static java.util.Collections.singletonList; @@ -109,13 +108,21 @@ public class ProjectStatusAction implements QualityGatesWsAction { @Override public void handle(Request request, Response response) throws Exception { - ProjectStatusWsResponse projectStatusWsResponse = doHandle(toProjectStatusWsRequest(request)); + String analysisId = request.param(PARAM_ANALYSIS_ID); + String projectId = request.param(PARAM_PROJECT_ID); + String projectKey = request.param(PARAM_PROJECT_KEY); + checkRequest( + !isNullOrEmpty(analysisId) + ^ !isNullOrEmpty(projectId) + ^ !isNullOrEmpty(projectKey), + MSG_ONE_PARAMETER_ONLY); + ProjectStatusWsResponse projectStatusWsResponse = doHandle(analysisId, projectId, projectKey); writeProtobuf(projectStatusWsResponse, request, response); } - private ProjectStatusWsResponse doHandle(ProjectStatusWsRequest request) { + private ProjectStatusWsResponse doHandle(String analysisId, String projectId, String projectKey) { try (DbSession dbSession = dbClient.openSession(false)) { - ProjectAndSnapshot projectAndSnapshot = getProjectAndSnapshot(dbSession, request); + ProjectAndSnapshot projectAndSnapshot = getProjectAndSnapshot(dbSession, analysisId, projectId, projectKey); checkPermission(projectAndSnapshot.project); Optional measureData = getQualityGateDetailsMeasureData(dbSession, projectAndSnapshot.project); @@ -125,19 +132,18 @@ public class ProjectStatusAction implements QualityGatesWsAction { } } - private ProjectAndSnapshot getProjectAndSnapshot(DbSession dbSession, ProjectStatusWsRequest request) { - String analysisUuid = request.getAnalysisId(); - if (!isNullOrEmpty(request.getAnalysisId())) { - return getSnapshotThenProject(dbSession, analysisUuid); - } else if (!isNullOrEmpty(request.getProjectId()) ^ !isNullOrEmpty(request.getProjectKey())) { - return getProjectThenSnapshot(dbSession, request); + private ProjectAndSnapshot getProjectAndSnapshot(DbSession dbSession, String analysisId, String projectId, String projectKey) { + if (!isNullOrEmpty(analysisId)) { + return getSnapshotThenProject(dbSession, analysisId); + } else if (!isNullOrEmpty(projectId) ^ !isNullOrEmpty(projectKey)) { + return getProjectThenSnapshot(dbSession, projectId, projectKey); } throw BadRequestException.create(MSG_ONE_PARAMETER_ONLY); } - private ProjectAndSnapshot getProjectThenSnapshot(DbSession dbSession, ProjectStatusWsRequest request) { - ComponentDto projectDto = componentFinder.getByUuidOrKey(dbSession, request.getProjectId(), request.getProjectKey(), ParamNames.PROJECT_ID_AND_KEY); + private ProjectAndSnapshot getProjectThenSnapshot(DbSession dbSession, String projectId, String projectKey) { + ComponentDto projectDto = componentFinder.getByUuidOrKey(dbSession, projectId, projectKey, ParamNames.PROJECT_ID_AND_KEY); java.util.Optional snapshot = dbClient.snapshotDao().selectLastAnalysisByRootComponentUuid(dbSession, projectDto.projectUuid()); return new ProjectAndSnapshot(projectDto, snapshot.orElse(null)); } @@ -165,19 +171,6 @@ public class ProjectStatusAction implements QualityGatesWsAction { : Optional.fromNullable(measures.get(0).getData()); } - private static ProjectStatusWsRequest toProjectStatusWsRequest(Request request) { - ProjectStatusWsRequest projectStatusWsRequest = new ProjectStatusWsRequest() - .setAnalysisId(request.param(PARAM_ANALYSIS_ID)) - .setProjectId(request.param(PARAM_PROJECT_ID)) - .setProjectKey(request.param(PARAM_PROJECT_KEY)); - checkRequest( - !isNullOrEmpty(projectStatusWsRequest.getAnalysisId()) - ^ !isNullOrEmpty(projectStatusWsRequest.getProjectId()) - ^ !isNullOrEmpty(projectStatusWsRequest.getProjectKey()), - MSG_ONE_PARAMETER_ONLY); - return projectStatusWsRequest; - } - private void checkPermission(ComponentDto project) { if (!userSession.hasComponentPermission(UserRole.ADMIN, project) && !userSession.hasComponentPermission(UserRole.USER, project)) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatter.java index 6c6a9508142..9e593013ffd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatter.java @@ -28,7 +28,7 @@ import java.util.function.Predicate; import java.util.stream.StreamSupport; import javax.annotation.Nullable; import org.sonar.db.component.SnapshotDto; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; import static com.google.common.base.Strings.isNullOrEmpty; import static org.sonar.api.utils.DateUtils.formatDateTime; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java index 4df3158c513..c3e33f58fcc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java @@ -29,12 +29,11 @@ import org.sonar.core.util.Uuids; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; +import org.sonar.db.permission.OrganizationPermission; import org.sonar.db.property.PropertyDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; -import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.qualitygate.SelectWsRequest; import static org.sonar.server.qualitygate.QualityGates.SONAR_QUALITYGATE_PROPERTY; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; @@ -86,29 +85,22 @@ public class SelectAction implements QualityGatesWsAction { @Override public void handle(Request request, Response response) { - doHandle(toSelectWsRequest(request)); - response.noContent(); - } + long gateId = request.mandatoryParamAsLong(PARAM_GATE_ID); + String projectId = request.param(PARAM_PROJECT_ID); + String projectKey = request.param(PARAM_PROJECT_KEY); - private void doHandle(SelectWsRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { - checkQualityGate(dbSession, request.getGateId()); - ComponentDto project = getProject(dbSession, request.getProjectId(), request.getProjectKey()); + checkQualityGate(dbSession, gateId); + ComponentDto project = getProject(dbSession, projectId, projectKey); dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto() .setKey(SONAR_QUALITYGATE_PROPERTY) .setResourceId(project.getId()) - .setValue(String.valueOf(request.getGateId()))); + .setValue(String.valueOf(gateId))); dbSession.commit(); } - } - - private static SelectWsRequest toSelectWsRequest(Request request) { - return new SelectWsRequest() - .setGateId(request.mandatoryParamAsLong(PARAM_GATE_ID)) - .setProjectId(request.param(PARAM_PROJECT_ID)) - .setProjectKey(request.param(PARAM_PROJECT_KEY)); + response.noContent(); } private ComponentDto getProject(DbSession dbSession, @Nullable String projectId, @Nullable String projectKey) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java index 9fb2035f2d6..8284bf3d9c4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java @@ -28,8 +28,7 @@ import org.sonar.db.qualitygate.QualityGateConditionDto; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.qualitygate.QualityGateConditionsUpdater; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse; -import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest; +import org.sonarqube.ws.Qualitygates.UpdateConditionWsResponse; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; @@ -80,34 +79,24 @@ public class UpdateConditionAction implements QualityGatesWsAction { public void handle(Request request, Response response) { userSession.checkPermission(ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid()); + int id = request.mandatoryParamAsInt(PARAM_ID); + String metric = request.mandatoryParam(PARAM_METRIC); + String operator = request.mandatoryParam(PARAM_OPERATOR); + String warning = request.param(PARAM_WARNING); + String error = request.param(PARAM_ERROR); + Integer period = request.paramAsInt(PARAM_PERIOD); + try (DbSession dbSession = dbClient.openSession(false)) { - writeProtobuf(doHandle(toWsRequest(request), dbSession), request, response); + QualityGateConditionDto condition = qualityGateConditionsUpdater.updateCondition(dbSession, id, metric, operator, warning, error, period); + UpdateConditionWsResponse.Builder updateConditionWsResponse = UpdateConditionWsResponse.newBuilder() + .setId(condition.getId()) + .setMetric(condition.getMetricKey()) + .setOp(condition.getOperator()); + setNullable(condition.getWarningThreshold(), updateConditionWsResponse::setWarning); + setNullable(condition.getErrorThreshold(), updateConditionWsResponse::setError); + setNullable(condition.getPeriod(), updateConditionWsResponse::setPeriod); + writeProtobuf(updateConditionWsResponse.build(), request, response); dbSession.commit(); } } - - private UpdateConditionWsResponse doHandle(UpdateConditionRequest request, DbSession dbSession) { - QualityGateConditionDto condition = qualityGateConditionsUpdater.updateCondition(dbSession, request.getConditionId(), request.getMetricKey(), request.getOperator(), - request.getWarning(), request.getError(), request.getPeriod()); - UpdateConditionWsResponse.Builder response = UpdateConditionWsResponse.newBuilder() - .setId(condition.getId()) - .setMetric(condition.getMetricKey()) - .setOp(condition.getOperator()); - setNullable(condition.getWarningThreshold(), response::setWarning); - setNullable(condition.getErrorThreshold(), response::setError); - setNullable(condition.getPeriod(), response::setPeriod); - return response.build(); - } - - private static UpdateConditionRequest toWsRequest(Request request) { - return UpdateConditionRequest.builder() - .setConditionId(request.mandatoryParamAsInt(PARAM_ID)) - .setMetricKey(request.mandatoryParam(PARAM_METRIC)) - .setOperator(request.mandatoryParam(PARAM_OPERATOR)) - .setWarning(request.param(PARAM_WARNING)) - .setError(request.param(PARAM_ERROR)) - .setPeriod(request.paramAsInt(PARAM_PERIOD)) - .build(); - } - } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java index 4f8e7ea7100..fecbbcdb8f7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java @@ -30,7 +30,7 @@ import org.sonar.db.DbSession; import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.server.qualityprofile.QProfileCopier; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.QualityProfiles.CopyWsResponse; +import org.sonarqube.ws.Qualityprofiles.CopyWsResponse; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java index a8c18e70bda..c179b663a56 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java @@ -36,7 +36,7 @@ import org.sonar.server.qualityprofile.QProfileName; import org.sonar.server.qualityprofile.QProfileResult; import org.sonar.server.qualityprofile.index.ActiveRuleIndexer; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java index cf048d75c9f..0831d3704bd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java @@ -34,8 +34,8 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.db.qualityprofile.ActiveRuleCountQuery; import org.sonar.db.qualityprofile.ActiveRuleDao; import org.sonar.db.qualityprofile.QProfileDto; -import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse; -import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse; +import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse.QualityProfile; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.qualityprofile.ActiveRuleDto.OVERRIDES; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java index a23522a21f6..3e90a178b13 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java @@ -50,8 +50,8 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.user.UserSession; import org.sonar.server.util.LanguageParamUtils; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import org.sonarqube.ws.client.qualityprofile.SearchWsRequest; import static com.google.common.base.Preconditions.checkState; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java index 2a753a4d501..32fb6e74e6b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java @@ -37,7 +37,7 @@ import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.db.qualityprofile.SearchGroupsQuery; import org.sonar.db.user.GroupDto; import org.sonarqube.ws.Common; -import org.sonarqube.ws.QualityProfiles; +import org.sonarqube.ws.Qualityprofiles; import org.sonarqube.ws.client.qualityprofile.SearchUsersRequest; import static org.sonar.api.server.ws.WebService.Param.PAGE; @@ -130,7 +130,7 @@ public class SearchGroupsAction implements QProfileWsAction { .stream() .collect(MoreCollectors.uniqueIndex(GroupDto::getId)); writeProtobuf( - QualityProfiles.SearchGroupsResponse.newBuilder() + Qualityprofiles.SearchGroupsResponse.newBuilder() .addAllGroups(groupMemberships.stream() .map(groupsMembership -> toGroup(groupsById.get(groupsMembership.getGroupId()), groupsMembership.isSelected())) .collect(toList())) @@ -151,8 +151,8 @@ public class SearchGroupsAction implements QProfileWsAction { .build(); } - private static QualityProfiles.SearchGroupsResponse.Group toGroup(GroupDto group, boolean isSelected) { - QualityProfiles.SearchGroupsResponse.Group.Builder builder = QualityProfiles.SearchGroupsResponse.Group.newBuilder() + private static Qualityprofiles.SearchGroupsResponse.Group toGroup(GroupDto group, boolean isSelected) { + Qualityprofiles.SearchGroupsResponse.Group.Builder builder = Qualityprofiles.SearchGroupsResponse.Group.newBuilder() .setName(group.getName()) .setSelected(isSelected); setNullable(group.getDescription(), builder::setDescription); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java index d031e80e188..c0ab8247722 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java @@ -38,7 +38,7 @@ import org.sonar.db.qualityprofile.UserMembershipDto; import org.sonar.db.user.UserDto; import org.sonar.server.issue.ws.AvatarResolver; import org.sonarqube.ws.Common; -import org.sonarqube.ws.QualityProfiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; import org.sonarqube.ws.client.qualityprofile.SearchUsersRequest; import static com.google.common.base.Strings.emptyToNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ShowAction.java index ce0b4a4ed87..0a48cee3064 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ShowAction.java @@ -38,10 +38,10 @@ import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.server.es.SearchOptions; import org.sonar.server.rule.index.RuleIndex; import org.sonar.server.rule.index.RuleQuery; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.ShowResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay; -import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile; import static java.util.Collections.singletonList; import static org.sonar.api.rule.RuleStatus.DEPRECATED; @@ -154,7 +154,7 @@ public class ShowAction implements QProfileWsAction { private static ShowResponse buildResponse(QProfileDto profile, boolean isDefault, Language language, long activeRules, long deprecatedActiveRules, long projects, @Nullable CompareToSonarWay compareToSonarWay) { - ShowResponse.Builder showResponseBuilder = QualityProfiles.ShowResponse.newBuilder(); + ShowResponse.Builder showResponseBuilder = Qualityprofiles.ShowResponse.newBuilder(); QualityProfile.Builder profileBuilder = QualityProfile.newBuilder() .setKey(profile.getKee()) .setName(profile.getName()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/root/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/root/ws/SearchAction.java index 51e76cfa0b4..ea8519f37c9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/root/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/root/ws/SearchAction.java @@ -28,7 +28,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.UserDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsRoot; +import org.sonarqube.ws.Root; import static org.sonar.server.ws.WsUtils.writeProtobuf; @@ -69,13 +69,13 @@ public class SearchAction implements RootsWsAction { } private static void writeResponse(Request request, Response response, List dtos) { - WsRoot.SearchWsResponse.Builder responseBuilder = WsRoot.SearchWsResponse.newBuilder(); - WsRoot.Root.Builder rootBuilder = WsRoot.Root.newBuilder(); + Root.SearchWsResponse.Builder responseBuilder = Root.SearchWsResponse.newBuilder(); + Root.RootContent.Builder rootBuilder = Root.RootContent.newBuilder(); dtos.forEach(dto -> responseBuilder.addRoots(toRoot(rootBuilder, dto))); writeProtobuf(responseBuilder.build(), request, response); } - private static WsRoot.Root toRoot(WsRoot.Root.Builder builder, UserDto dto) { + private static Root.RootContent toRoot(Root.RootContent.Builder builder, UserDto dto) { builder.clear(); builder.setLogin(dto.getLogin()); if (dto.getName() != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java index c1dad3459e6..07d6c2d7596 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java @@ -39,7 +39,7 @@ import org.sonar.server.test.index.CoveredFileDoc; import org.sonar.server.test.index.TestDoc; import org.sonar.server.test.index.TestIndex; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsTests; +import org.sonarqube.ws.Tests; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; @@ -86,10 +86,10 @@ public class CoveredFilesAction implements TestsWsAction { List coveredFiles = index.coveredFiles(testId); Map componentsByUuid = buildComponentsByUuid(coveredFiles); - WsTests.CoveredFilesResponse.Builder responseBuilder = WsTests.CoveredFilesResponse.newBuilder(); + Tests.CoveredFilesResponse.Builder responseBuilder = Tests.CoveredFilesResponse.newBuilder(); if (!coveredFiles.isEmpty()) { for (CoveredFileDoc doc : coveredFiles) { - WsTests.CoveredFilesResponse.CoveredFile.Builder fileBuilder = WsTests.CoveredFilesResponse.CoveredFile.newBuilder(); + Tests.CoveredFilesResponse.CoveredFile.Builder fileBuilder = Tests.CoveredFilesResponse.CoveredFile.newBuilder(); fileBuilder.setId(doc.fileUuid()); fileBuilder.setCoveredLines(doc.coveredLines().size()); ComponentDto component = componentsByUuid.get(doc.fileUuid()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java index 57afa5ad572..f8f28daf382 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java @@ -46,7 +46,7 @@ import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; import org.sonar.server.ws.WsUtils; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsTests; +import org.sonarqube.ws.Tests; import static org.sonar.api.server.ws.WebService.Param.PAGE; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; @@ -158,7 +158,7 @@ public class ListAction implements TestsWsAction { componentsByTestFileUuid = buildComponentsByTestFileUuid(dbSession, tests.getDocs()); } - WsTests.ListResponse.Builder responseBuilder = WsTests.ListResponse.newBuilder(); + Tests.ListResponse.Builder responseBuilder = Tests.ListResponse.newBuilder(); responseBuilder.setPaging(Common.Paging.newBuilder() .setPageIndex(searchOptions.getPage()) .setPageSize(searchOptions.getLimit()) @@ -166,7 +166,7 @@ public class ListAction implements TestsWsAction { .build()); for (TestDoc testDoc : tests.getDocs()) { - WsTests.Test.Builder testBuilder = WsTests.Test.newBuilder(); + Tests.Test.Builder testBuilder = Tests.Test.newBuilder(); testBuilder.setId(testDoc.testUuid()); testBuilder.setName(StringUtils.defaultString(testDoc.name())); testBuilder.setFileId(testDoc.fileUuid()); @@ -176,7 +176,7 @@ public class ListAction implements TestsWsAction { testBuilder.setFileName(component.longName()); setNullable(component.getBranch(), testBuilder::setFileBranch); } - testBuilder.setStatus(WsTests.TestStatus.valueOf(testDoc.status())); + testBuilder.setStatus(Tests.TestStatus.valueOf(testDoc.status())); if (testDoc.durationInMs() != null) { testBuilder.setDurationInMs(testDoc.durationInMs()); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CreateAction.java index b9f6c4fb7f2..df3409fd416 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CreateAction.java @@ -32,7 +32,7 @@ import org.sonar.server.user.ExternalIdentity; import org.sonar.server.user.NewUser; import org.sonar.server.user.UserSession; import org.sonar.server.user.UserUpdater; -import org.sonarqube.ws.WsUsers.CreateWsResponse; +import org.sonarqube.ws.Users.CreateWsResponse; import org.sonarqube.ws.client.user.CreateRequest; import static com.google.common.base.Strings.emptyToNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java index 9ddfdc9190b..60be4700c6e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java @@ -33,15 +33,15 @@ import org.sonar.db.user.UserDto; import org.sonar.server.issue.ws.AvatarResolver; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsUsers.CurrentWsResponse; +import org.sonarqube.ws.Users.CurrentWsResponse; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Strings.emptyToNull; import static java.util.Collections.singletonList; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsUsers.CurrentWsResponse.Permissions; -import static org.sonarqube.ws.WsUsers.CurrentWsResponse.newBuilder; +import static org.sonarqube.ws.Users.CurrentWsResponse.Permissions; +import static org.sonarqube.ws.Users.CurrentWsResponse.newBuilder; import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_CURRENT; public class CurrentAction implements UsersWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java index d3b052bcfea..e12438d042d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java @@ -41,8 +41,8 @@ import org.sonar.db.user.UserDto; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.user.UserSession; import org.sonar.server.usergroups.DefaultGroupFinder; -import org.sonarqube.ws.WsUsers.GroupsWsResponse; -import org.sonarqube.ws.WsUsers.GroupsWsResponse.Group; +import org.sonarqube.ws.Users.GroupsWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse.Group; import org.sonarqube.ws.client.user.GroupsRequest; import static com.google.common.base.Preconditions.checkArgument; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/IdentityProvidersAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/IdentityProvidersAction.java index 7219454184c..11d27802d87 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/IdentityProvidersAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/IdentityProvidersAction.java @@ -28,8 +28,8 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.authentication.IdentityProviderRepository; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.IdentityProvidersWsResponse; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.IdentityProvidersWsResponse; import static org.sonar.server.ws.WsUtils.writeProtobuf; @@ -61,12 +61,12 @@ public class IdentityProvidersAction implements UsersWsAction { return response.build(); } - private enum IdentityProviderToWsResponse implements Function { + private enum IdentityProviderToWsResponse implements Function { INSTANCE; @Override - public WsUsers.IdentityProvider apply(@Nonnull IdentityProvider input) { - WsUsers.IdentityProvider.Builder builder = WsUsers.IdentityProvider.newBuilder() + public Users.IdentityProvider apply(@Nonnull IdentityProvider input) { + Users.IdentityProvider.Builder builder = Users.IdentityProvider.newBuilder() .setKey(input.getKey()) .setName(input.getName()); Display display = input.getDisplay(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java index 1a07d9b07e2..f10ba7f7378 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java @@ -40,8 +40,8 @@ import org.sonar.server.user.UserSession; import org.sonar.server.user.index.UserDoc; import org.sonar.server.user.index.UserIndex; import org.sonar.server.user.index.UserQuery; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.SearchWsResponse; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.SearchWsResponse; import org.sonarqube.ws.client.user.SearchRequest; import static com.google.common.base.MoreObjects.firstNonNull; @@ -65,10 +65,10 @@ import static org.sonar.server.user.ws.UserJsonWriter.FIELD_NAME; import static org.sonar.server.user.ws.UserJsonWriter.FIELD_SCM_ACCOUNTS; import static org.sonar.server.user.ws.UserJsonWriter.FIELD_TOKENS_COUNT; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsUsers.SearchWsResponse.Groups; -import static org.sonarqube.ws.WsUsers.SearchWsResponse.ScmAccounts; -import static org.sonarqube.ws.WsUsers.SearchWsResponse.User; -import static org.sonarqube.ws.WsUsers.SearchWsResponse.newBuilder; +import static org.sonarqube.ws.Users.SearchWsResponse.Groups; +import static org.sonarqube.ws.Users.SearchWsResponse.ScmAccounts; +import static org.sonarqube.ws.Users.SearchWsResponse.User; +import static org.sonarqube.ws.Users.SearchWsResponse.newBuilder; public class SearchAction implements UsersWsAction { @@ -111,11 +111,11 @@ public class SearchAction implements UsersWsAction { @Override public void handle(Request request, Response response) throws Exception { - WsUsers.SearchWsResponse wsResponse = doHandle(toSearchRequest(request)); + Users.SearchWsResponse wsResponse = doHandle(toSearchRequest(request)); writeProtobuf(wsResponse, request, response); } - private WsUsers.SearchWsResponse doHandle(SearchRequest request) { + private Users.SearchWsResponse doHandle(SearchRequest request) { SearchOptions options = new SearchOptions().setPage(request.getPage(), request.getPageSize()); List fields = request.getPossibleFields(); SearchResult result = userIndex.search(UserQuery.builder().setTextQuery(request.getQuery()).build(), options); diff --git a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java index f7117ec4fd3..2f9bd1f33e0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java @@ -29,7 +29,7 @@ import org.sonar.db.DbSession; import org.sonar.db.organization.OrganizationDto; import org.sonar.db.user.GroupDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsUserGroups; +import org.sonarqube.ws.UserGroups; import static java.lang.String.format; import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH; @@ -105,7 +105,7 @@ public class CreateAction implements UserGroupsWsAction { } private void writeResponse(Request request, Response response, OrganizationDto organization, GroupDto group) { - WsUserGroups.CreateWsResponse.Builder respBuilder = WsUserGroups.CreateWsResponse.newBuilder(); + UserGroups.CreateWsResponse.Builder respBuilder = UserGroups.CreateWsResponse.newBuilder(); // 'default' is always false as it's not possible to create a default group respBuilder.setGroup(toProtobuf(organization, group, 0, false)); writeProtobuf(respBuilder.build(), request, response); diff --git a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java index bc5b4df8b88..25835028a5a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java @@ -30,7 +30,7 @@ import org.sonar.db.user.GroupDto; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.usergroups.DefaultGroupFinder; -import org.sonarqube.ws.WsUserGroups; +import org.sonarqube.ws.UserGroups; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.core.util.Protobuf.setNullable; @@ -142,8 +142,8 @@ public class GroupWsSupport { checkArgument(!defaultGroup.getId().equals(groupDto.getId()), "Default group '%s' cannot be used to perform this action", groupDto.getName()); } - static WsUserGroups.Group.Builder toProtobuf(OrganizationDto organization, GroupDto group, int membersCount, boolean isDefault) { - WsUserGroups.Group.Builder wsGroup = WsUserGroups.Group.newBuilder() + static UserGroups.Group.Builder toProtobuf(OrganizationDto organization, GroupDto group, int membersCount, boolean isDefault) { + UserGroups.Group.Builder wsGroup = UserGroups.Group.newBuilder() .setId(group.getId()) .setOrganization(organization.getKey()) .setName(group.getName()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java index 13632c5bc24..2fd316d063d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java @@ -47,8 +47,8 @@ import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; import static org.sonar.server.es.SearchOptions.MAX_LIMIT; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_ORGANIZATION_KEY; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.WsUserGroups.Group; -import static org.sonarqube.ws.WsUserGroups.SearchWsResponse; +import static org.sonarqube.ws.UserGroups.Group; +import static org.sonarqube.ws.UserGroups.SearchWsResponse; public class SearchAction implements UserGroupsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java index 86b54687277..a7acd5fe9b4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java @@ -32,7 +32,7 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserMembershipQuery; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsUserGroups; +import org.sonarqube.ws.UserGroups; import static java.lang.String.format; import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH; @@ -130,7 +130,7 @@ public class UpdateAction implements UserGroupsWsAction { .build(); int membersCount = dbClient.groupMembershipDao().countMembers(dbSession, query); - WsUserGroups.UpdateWsResponse.Builder respBuilder = WsUserGroups.UpdateWsResponse.newBuilder(); + UserGroups.UpdateWsResponse.Builder respBuilder = UserGroups.UpdateWsResponse.newBuilder(); // 'default' is always false as it's not possible to update a default group respBuilder.setGroup(toProtobuf(organization, group, membersCount, false)); writeProtobuf(respBuilder.build(), request, response); diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java index 12e1c7b5e7e..cacf3c77994 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java @@ -31,8 +31,8 @@ import org.sonar.db.user.UserTokenDto; import org.sonar.server.exceptions.ServerException; import org.sonar.server.user.UserSession; import org.sonar.server.usertoken.TokenGenerator; -import org.sonarqube.ws.WsUserTokens; -import org.sonarqube.ws.WsUserTokens.GenerateWsResponse; +import org.sonarqube.ws.UserTokens; +import org.sonarqube.ws.UserTokens.GenerateWsResponse; import org.sonarqube.ws.client.usertoken.GenerateWsRequest; import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR; @@ -81,11 +81,11 @@ public class GenerateAction implements UserTokensWsAction { @Override public void handle(Request request, Response response) throws Exception { - WsUserTokens.GenerateWsResponse generateWsResponse = doHandle(toCreateWsRequest(request)); + UserTokens.GenerateWsResponse generateWsResponse = doHandle(toCreateWsRequest(request)); writeProtobuf(generateWsResponse, request, response); } - private WsUserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) { + private UserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { checkWsRequest(dbSession, request); TokenPermissionsValidator.validate(userSession, request.getLogin()); @@ -149,7 +149,7 @@ public class GenerateAction implements UserTokensWsAction { } private static GenerateWsResponse buildResponse(UserTokenDto userTokenDto, String token) { - return WsUserTokens.GenerateWsResponse.newBuilder() + return UserTokens.GenerateWsResponse.newBuilder() .setLogin(userTokenDto.getLogin()) .setName(userTokenDto.getName()) .setToken(token) diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java index 58895ecfb28..cadf64b42bb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java @@ -28,7 +28,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.UserTokenDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsUserTokens.SearchWsResponse; +import org.sonarqube.ws.UserTokens.SearchWsResponse; import org.sonarqube.ws.client.usertoken.SearchWsRequest; import static org.sonar.api.utils.DateUtils.formatDateTime; diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectActionTest.java index b14f30b70a0..1b20167950d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectActionTest.java @@ -25,7 +25,7 @@ import org.sonar.scanner.protocol.input.FileData; import org.sonar.scanner.protocol.input.ProjectRepositories; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsBatch.WsProjectResponse; +import org.sonarqube.ws.Batch.WsProjectResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; diff --git a/server/sonar-server/src/test/java/org/sonar/server/branch/ws/ListActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/branch/ws/ListActionTest.java index e008e9fe9b4..bb8a93ae72b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/branch/ws/ListActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/branch/ws/ListActionTest.java @@ -52,9 +52,9 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsBranches; -import org.sonarqube.ws.WsBranches.Branch; -import org.sonarqube.ws.WsBranches.ListWsResponse; +import org.sonarqube.ws.ProjectBranches; +import org.sonarqube.ws.ProjectBranches.Branch; +import org.sonarqube.ws.ProjectBranches.ListWsResponse; import static java.lang.String.format; import static java.util.Collections.emptySet; @@ -70,7 +70,7 @@ import static org.sonar.api.rules.RuleType.VULNERABILITY; import static org.sonar.api.utils.DateUtils.dateToLong; import static org.sonar.api.utils.DateUtils.parseDateTime; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.WsBranches.Branch.Status; +import static org.sonarqube.ws.ProjectBranches.Branch.Status; public class ListActionTest { @@ -218,9 +218,9 @@ public class ListActionTest { ComponentDto shortLivingBranch = db.components().insertProjectBranch(project, b -> b.setKey("short").setBranchType(BranchType.SHORT).setMergeBranchUuid(project.uuid())); - WsBranches.ShowWsResponse response = ws.newRequest() + ProjectBranches.ShowWsResponse response = ws.newRequest() .setParam("project", shortLivingBranch.getKey()) - .executeProtobuf(WsBranches.ShowWsResponse.class); + .executeProtobuf(ProjectBranches.ShowWsResponse.class); assertThat(response.getBranch()) .extracting(Branch::getName, Branch::getType, Branch::getMergeBranch) @@ -285,7 +285,7 @@ public class ListActionTest { .setParam("project", project.getKey()) .executeProtobuf(ListWsResponse.class); - assertThat(response.getBranchesList().stream().map(WsBranches.Branch::getStatus)) + assertThat(response.getBranchesList().stream().map(ProjectBranches.Branch::getStatus)) .extracting(Status::hasBugs, Status::getBugs, Status::hasVulnerabilities, Status::getVulnerabilities, Status::hasCodeSmells, Status::getCodeSmells) .containsExactlyInAnyOrder( tuple(false, 0L, false, 0L, false, 0L), @@ -306,7 +306,7 @@ public class ListActionTest { .setParam("project", project.getKey()) .executeProtobuf(ListWsResponse.class); - assertThat(response.getBranchesList().stream().filter(b -> b.getType().equals(Common.BranchType.SHORT)).map(WsBranches.Branch::getStatus)) + assertThat(response.getBranchesList().stream().filter(b -> b.getType().equals(Common.BranchType.SHORT)).map(ProjectBranches.Branch::getStatus)) .extracting(Status::getBugs, Status::getVulnerabilities, Status::getCodeSmells) .containsExactlyInAnyOrder(tuple(0L, 0L, 0L)); } @@ -337,7 +337,7 @@ public class ListActionTest { .executeProtobuf(ListWsResponse.class); assertThat(response.getBranchesList()) - .extracting(WsBranches.Branch::getType, WsBranches.Branch::hasAnalysisDate, b -> "".equals(b.getAnalysisDate()) ? null : dateToLong(parseDateTime(b.getAnalysisDate()))) + .extracting(ProjectBranches.Branch::getType, ProjectBranches.Branch::hasAnalysisDate, b -> "".equals(b.getAnalysisDate()) ? null : dateToLong(parseDateTime(b.getAnalysisDate()))) .containsExactlyInAnyOrder( tuple(Common.BranchType.LONG, false, null), tuple(Common.BranchType.SHORT, false, null), diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index 0f97dde5b8a..d21308296a8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -50,11 +50,12 @@ import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsCe.ActivityResponse; -import org.sonarqube.ws.WsCe.Task; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce.ActivityResponse; +import org.sonarqube.ws.Ce.Task; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -110,7 +111,7 @@ public class ActivityActionTest { Task task = activityResponse.getTasks(0); assertThat(task.getOrganization()).isEqualTo(org2.getKey()); assertThat(task.getId()).isEqualTo("T2"); - assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED); + assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED); assertThat(task.getComponentId()).isEqualTo(project2.uuid()); assertThat(task.hasAnalysisId()).isFalse(); assertThat(task.getExecutionTimeMs()).isEqualTo(500L); @@ -118,7 +119,7 @@ public class ActivityActionTest { task = activityResponse.getTasks(1); assertThat(task.getId()).isEqualTo("T1"); - assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS); + assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS); assertThat(task.getComponentId()).isEqualTo(project1.uuid()); assertThat(task.getLogs()).isFalse(); assertThat(task.getOrganization()).isEqualTo(org1.getKey()); @@ -226,7 +227,7 @@ public class ActivityActionTest { assertThat(activityResponse.getTasksCount()).isEqualTo(1); assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T1"); - assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS); + assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS); assertThat(activityResponse.getTasks(0).getComponentId()).isEqualTo(project1.uuid()); } @@ -354,9 +355,9 @@ public class ActivityActionTest { ActivityResponse response = ws.newRequest().executeProtobuf(ActivityResponse.class); assertThat(response.getTasksList()) - .extracting(Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey) + .extracting(Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey) .containsExactlyInAnyOrder( - tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, longLivingBranch.getKey())); + tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.SUCCESS, longLivingBranch.getKey())); } @Test @@ -375,10 +376,10 @@ public class ActivityActionTest { .executeProtobuf(ActivityResponse.class); assertThat(response.getTasksList()) - .extracting(Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus) + .extracting(Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus) .containsExactlyInAnyOrder( - tuple("T1", branch, Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS), - tuple("T2", branch, Common.BranchType.LONG, WsCe.TaskStatus.PENDING)); + tuple("T1", branch, Common.BranchType.LONG, Ce.TaskStatus.IN_PROGRESS), + tuple("T2", branch, Common.BranchType.LONG, Ce.TaskStatus.PENDING)); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java index 02dc23d6a80..ca9f836a290 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java @@ -40,7 +40,8 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto; @@ -101,7 +102,7 @@ public class ActivityStatusActionTest { insertActivity(CeActivityDto.Status.FAILED, projectUuid); insertActivity(CeActivityDto.Status.FAILED, anotherProjectUuid); - WsCe.ActivityStatusWsResponse result = call(projectUuid); + Ce.ActivityStatusWsResponse result = call(projectUuid); assertThat(result.getPending()).isEqualTo(2); assertThat(result.getFailing()).isEqualTo(1); @@ -109,7 +110,7 @@ public class ActivityStatusActionTest { @Test public void empty_status() { - WsCe.ActivityStatusWsResponse result = call(); + Ce.ActivityStatusWsResponse result = call(); assertThat(result.getPending()).isEqualTo(0); assertThat(result.getFailing()).isEqualTo(0); @@ -174,19 +175,19 @@ public class ActivityStatusActionTest { db.commit(); } - private WsCe.ActivityStatusWsResponse call() { + private Ce.ActivityStatusWsResponse call() { return callByComponentUuidOrComponentKey(null, null); } - private WsCe.ActivityStatusWsResponse call(String componentUuid) { + private Ce.ActivityStatusWsResponse call(String componentUuid) { return callByComponentUuidOrComponentKey(componentUuid, null); } - private WsCe.ActivityStatusWsResponse callByComponentKey(String componentKey) { + private Ce.ActivityStatusWsResponse callByComponentKey(String componentKey) { return callByComponentUuidOrComponentKey(null, componentKey); } - private WsCe.ActivityStatusWsResponse callByComponentUuidOrComponentKey(@Nullable String componentUuid, @Nullable String componentKey) { + private Ce.ActivityStatusWsResponse callByComponentUuidOrComponentKey(@Nullable String componentUuid, @Nullable String componentKey) { TestRequest request = ws.newRequest(); if (componentUuid != null) { request.setParam(PARAM_COMPONENT_ID, componentUuid); @@ -194,6 +195,6 @@ public class ActivityStatusActionTest { if (componentKey != null) { request.setParam(DEPRECATED_PARAM_COMPONENT_KEY, componentKey); } - return request.executeProtobuf(WsCe.ActivityStatusWsResponse.class); + return request.executeProtobuf(Ce.ActivityStatusWsResponse.class); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java index cf75d3afc54..0ad97b9b1c7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java @@ -40,9 +40,10 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Java6Assertions.tuple; @@ -74,9 +75,9 @@ public class ComponentActionTest { ComponentDto project = db.components().insertPrivateProject(); userSession.addProjectPermission(UserRole.USER, project); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, project.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getQueueCount()).isEqualTo(0); assertThat(response.hasCurrent()).isFalse(); @@ -95,9 +96,9 @@ public class ComponentActionTest { insertQueue("T4", project1, IN_PROGRESS); insertQueue("T5", project1, PENDING); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, project1.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getQueueCount()).isEqualTo(2); assertThat(response.getQueue(0).getId()).isEqualTo("T4"); assertThat(response.getQueue(1).getId()).isEqualTo("T5"); @@ -106,7 +107,7 @@ public class ComponentActionTest { assertThat(response.getCurrent().getId()).isEqualTo("T3"); assertThat(response.getCurrent().hasAnalysisId()).isFalse(); assertThat(response.getQueueList()) - .extracting(WsCe.Task::getOrganization) + .extracting(Ce.Task::getOrganization) .containsOnly(organization.getKey()); assertThat(response.getCurrent().getOrganization()).isEqualTo(organization.getKey()); } @@ -118,9 +119,9 @@ public class ComponentActionTest { SnapshotDto analysis = db.components().insertSnapshot(project); insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, project.getDbKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.hasCurrent()).isTrue(); assertThat(response.getCurrent().getId()).isEqualTo("T1"); assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid()); @@ -133,9 +134,9 @@ public class ComponentActionTest { SnapshotDto analysis = db.components().insertSnapshot(project); insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT_ID, project.uuid()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.hasCurrent()).isTrue(); assertThat(response.getCurrent().getId()).isEqualTo("T1"); assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid()); @@ -151,9 +152,9 @@ public class ComponentActionTest { insertActivity("T4", project, CeActivityDto.Status.CANCELED); insertActivity("T5", project, CeActivityDto.Status.CANCELED); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, project.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getQueueCount()).isEqualTo(0); // T3 is the latest task executed on PROJECT_1 ignoring Canceled ones assertThat(response.hasCurrent()).isTrue(); @@ -170,14 +171,14 @@ public class ComponentActionTest { insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch()); insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name()); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, project.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getCurrent()) - .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey) + .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey) .containsOnly( - "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, project.getKey()); + "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.SUCCESS, project.getKey()); } @Test @@ -192,15 +193,15 @@ public class ComponentActionTest { insertCharacteristic(queue2, BRANCH_KEY, longLivingBranch.getBranch()); insertCharacteristic(queue2, BRANCH_TYPE_KEY, LONG.name()); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, longLivingBranch.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getQueueList()) - .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey) + .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey) .containsOnly( - tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS, project.getKey()), - tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.PENDING, project.getKey())); + tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.IN_PROGRESS, project.getKey()), + tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.PENDING, project.getKey())); } @Test @@ -217,12 +218,12 @@ public class ComponentActionTest { insertCharacteristic(shortLivingBranchQueue, BRANCH_KEY, shortLivingBranch.getBranch()); insertCharacteristic(shortLivingBranchQueue, BRANCH_TYPE_KEY, SHORT.name()); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam(PARAM_COMPONENT, longLivingBranch.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.getQueueList()) - .extracting(WsCe.Task::getId, WsCe.Task::getComponentKey, WsCe.Task::getBranch, WsCe.Task::getBranchType) + .extracting(Ce.Task::getId, Ce.Task::getComponentKey, Ce.Task::getBranch, Ce.Task::getBranchType) .containsOnly( tuple("Main", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE), tuple("Long", longLivingBranch.getKey(), longLivingBranch.getBranch(), Common.BranchType.LONG), @@ -236,9 +237,9 @@ public class ComponentActionTest { SnapshotDto analysis = db.components().insertSnapshot(project); insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis); - WsCe.ProjectResponse response = ws.newRequest() + Ce.ProjectResponse response = ws.newRequest() .setParam("componentKey", project.getKey()) - .executeProtobuf(WsCe.ProjectResponse.class); + .executeProtobuf(Ce.ProjectResponse.class); assertThat(response.hasCurrent()).isTrue(); assertThat(response.getCurrent().getId()).isEqualTo("T1"); assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java index 2e92ee646ef..d654fa390a3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java @@ -37,8 +37,9 @@ import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; @@ -77,12 +78,12 @@ public class SubmitActionTest { when(reportSubmitter.submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"), anyMapOf(String.class, String.class), any(InputStream.class))).thenReturn(A_CE_TASK); - WsCe.SubmitResponse submitResponse = tester.newRequest() + Ce.SubmitResponse submitResponse = tester.newRequest() .setParam("projectKey", "my_project") .setParam("projectName", "My Project") .setPart("report", new ByteArrayInputStream("{binary}".getBytes()), "foo.bar") .setMethod("POST") - .executeProtobuf(WsCe.SubmitResponse.class); + .executeProtobuf(Ce.SubmitResponse.class); verify(reportSubmitter).submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"), anyMapOf(String.class, String.class), any(InputStream.class)); @@ -97,13 +98,13 @@ public class SubmitActionTest { anyMapOf(String.class, String.class), any(InputStream.class))).thenReturn(A_CE_TASK); String[] characteristics = {"branch=branch1", "key=value1=value2"}; - WsCe.SubmitResponse submitResponse = tester.newRequest() + Ce.SubmitResponse submitResponse = tester.newRequest() .setParam("projectKey", "my_project") .setParam("projectName", "My Project") .setMultiParam("characteristic", Arrays.asList(characteristics)) .setPart("report", new ByteArrayInputStream("{binary}".getBytes()), "foo.bar") .setMethod("POST") - .executeProtobuf(WsCe.SubmitResponse.class); + .executeProtobuf(Ce.SubmitResponse.class); assertThat(submitResponse.getTaskId()).isEqualTo("TASK_1"); verify(reportSubmitter).submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"), diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java index 14d998d9231..620444228a4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java @@ -41,8 +41,9 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import static java.util.Collections.singleton; import static org.assertj.core.api.Assertions.assertThat; @@ -88,12 +89,12 @@ public class TaskActionTest { queueDto.setSubmitterLogin("john"); persist(queueDto); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); + .executeProtobuf(Ce.TaskResponse.class); assertThat(taskResponse.getTask().getOrganization()).isEqualTo(organizationDto.getKey()); assertThat(taskResponse.getTask().getId()).isEqualTo(SOME_TASK_UUID); - assertThat(taskResponse.getTask().getStatus()).isEqualTo(WsCe.TaskStatus.PENDING); + assertThat(taskResponse.getTask().getStatus()).isEqualTo(Ce.TaskStatus.PENDING); assertThat(taskResponse.getTask().getSubmitterLogin()).isEqualTo("john"); assertThat(taskResponse.getTask().getComponentId()).isEqualTo(project.uuid()); assertThat(taskResponse.getTask().getComponentKey()).isEqualTo(project.getDbKey()); @@ -109,13 +110,13 @@ public class TaskActionTest { CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID); persist(activityDto); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getOrganization()).isEqualTo(organizationDto.getKey()); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); - assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED); + assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED); assertThat(task.getComponentId()).isEqualTo(project.uuid()); assertThat(task.getComponentKey()).isEqualTo(project.getDbKey()); assertThat(task.getComponentName()).isEqualTo(project.name()); @@ -135,12 +136,12 @@ public class TaskActionTest { insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch()); insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name()); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); + .executeProtobuf(Ce.TaskResponse.class); assertThat(taskResponse.getTask()) - .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getComponentKey) + .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getComponentKey) .containsExactlyInAnyOrder(SOME_TASK_UUID, longLivingBranch.getBranch(), Common.BranchType.LONG, longLivingBranch.getKey()); } @@ -152,12 +153,12 @@ public class TaskActionTest { insertCharacteristic(queueDto, BRANCH_KEY, branch); insertCharacteristic(queueDto, BRANCH_TYPE_KEY, LONG.name()); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); + .executeProtobuf(Ce.TaskResponse.class); assertThat(taskResponse.getTask()) - .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::hasComponentKey) + .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::hasComponentKey) .containsExactlyInAnyOrder(SOME_TASK_UUID, branch, Common.BranchType.LONG, false); } @@ -170,11 +171,11 @@ public class TaskActionTest { .setErrorStacktrace("error stack"); persist(activityDto); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) .setParam("additionalFields", "stacktrace") - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage()); assertThat(task.hasErrorStacktrace()).isTrue(); @@ -190,10 +191,10 @@ public class TaskActionTest { .setErrorStacktrace("error stack"); persist(activityDto); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage()); assertThat(task.hasErrorStacktrace()).isFalse(); @@ -207,11 +208,11 @@ public class TaskActionTest { persist(createActivityDto(SOME_TASK_UUID)); persistScannerContext(SOME_TASK_UUID, scannerContext); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) .setParam("additionalFields", "scannerContext") - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); assertThat(task.getScannerContext()).isEqualTo(scannerContext); } @@ -224,11 +225,11 @@ public class TaskActionTest { persist(createActivityDto(SOME_TASK_UUID)); persistScannerContext(SOME_TASK_UUID, scannerContext); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) .setParam("additionalFields", "stacktrace") - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); assertThat(task.hasScannerContext()).isFalse(); } @@ -241,10 +242,10 @@ public class TaskActionTest { .setErrorMessage("error msg"); persist(activityDto); - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", SOME_TASK_UUID) - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(SOME_TASK_UUID); assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage()); assertThat(task.hasErrorStacktrace()).isFalse(); @@ -433,10 +434,10 @@ public class TaskActionTest { } private void call(String taskUuid) { - WsCe.TaskResponse taskResponse = ws.newRequest() + Ce.TaskResponse taskResponse = ws.newRequest() .setParam("id", taskUuid) - .executeProtobuf(WsCe.TaskResponse.class); - WsCe.Task task = taskResponse.getTask(); + .executeProtobuf(Ce.TaskResponse.class); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(taskUuid); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java index c2e32f7b895..850e6f5c787 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java @@ -31,7 +31,8 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.organization.OrganizationDto; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -54,11 +55,11 @@ public class TaskFormatterTest { dto.setStatus(CeQueueDto.Status.PENDING); dto.setCreatedAt(1_450_000_000_000L); - WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto); + Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto); assertThat(wsTask.getType()).isEqualTo("TYPE"); assertThat(wsTask.getId()).isEqualTo("UUID"); - assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.PENDING); + assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.PENDING); assertThat(wsTask.getLogs()).isFalse(); assertThat(wsTask.getSubmittedAt()).isEqualTo(DateUtils.formatDateTime(new Date(1_450_000_000_000L))); assertThat(wsTask.hasScannerContext()).isFalse(); @@ -88,7 +89,7 @@ public class TaskFormatterTest { dto.setComponentUuid(uuid); dto.setSubmitterLogin("rob"); - WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto); + Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto); assertThat(wsTask.getType()).isEqualTo("TYPE"); assertThat(wsTask.getId()).isEqualTo("UUID"); @@ -96,7 +97,7 @@ public class TaskFormatterTest { assertThat(wsTask.getComponentKey()).isEqualTo("COMPONENT_KEY"); assertThat(wsTask.getComponentName()).isEqualTo("Component Name"); assertThat(wsTask.getComponentQualifier()).isEqualTo("TRK"); - assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.IN_PROGRESS); + assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.IN_PROGRESS); assertThat(wsTask.getLogs()).isFalse(); assertThat(wsTask.getSubmitterLogin()).isEqualTo("rob"); assertThat(wsTask.hasExecutionTimeMs()).isTrue(); @@ -113,7 +114,7 @@ public class TaskFormatterTest { dto.setCreatedAt(1_450_000_000_000L); dto.setComponentUuid("DOES_NOT_EXIST"); - WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto); + Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto); assertThat(wsTask.getComponentId()).isEqualTo("DOES_NOT_EXIST"); assertThat(wsTask.hasComponentKey()).isFalse(); @@ -132,7 +133,7 @@ public class TaskFormatterTest { dto.setStartedAt(startedAt); when(system2.now()).thenReturn(now); - WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto); + Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto); assertThat(wsTask.getExecutionTimeMs()).isEqualTo(now - startedAt); } @@ -151,7 +152,7 @@ public class TaskFormatterTest { dto2.setStatus(CeQueueDto.Status.PENDING); dto2.setCreatedAt(1_451_000_000_000L); - Iterable wsTasks = underTest.formatQueue(db.getSession(), asList(dto1, dto2)); + Iterable wsTasks = underTest.formatQueue(db.getSession(), asList(dto1, dto2)); assertThat(wsTasks).extracting("id").containsExactly("UUID1", "UUID2"); } @@ -159,11 +160,11 @@ public class TaskFormatterTest { public void formatActivity() { CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED); - WsCe.Task wsTask = underTest.formatActivity(db.getSession(), dto, null); + Ce.Task wsTask = underTest.formatActivity(db.getSession(), dto, null); assertThat(wsTask.getType()).isEqualTo(CeTaskTypes.REPORT); assertThat(wsTask.getId()).isEqualTo("UUID"); - assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED); + assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.FAILED); assertThat(wsTask.getSubmittedAt()).isEqualTo(DateUtils.formatDateTime(new Date(1_450_000_000_000L))); assertThat(wsTask.getExecutionTimeMs()).isEqualTo(500L); assertThat(wsTask.getAnalysisId()).isEqualTo("U1"); @@ -176,7 +177,7 @@ public class TaskFormatterTest { CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED); String expected = "scanner context baby!"; - WsCe.Task wsTask = underTest.formatActivity(db.getSession(), dto, expected); + Ce.Task wsTask = underTest.formatActivity(db.getSession(), dto, expected); assertThat(wsTask.hasScannerContext()).isTrue(); assertThat(wsTask.getScannerContext()).isEqualTo(expected); @@ -187,7 +188,7 @@ public class TaskFormatterTest { CeActivityDto dto1 = newActivity("UUID1", "COMPONENT_UUID", CeActivityDto.Status.FAILED); CeActivityDto dto2 = newActivity("UUID2", "COMPONENT_UUID", CeActivityDto.Status.SUCCESS); - Iterable wsTasks = underTest.formatActivity(db.getSession(), asList(dto1, dto2)); + Iterable wsTasks = underTest.formatActivity(db.getSession(), asList(dto1, dto2)); assertThat(wsTasks).extracting("id").containsExactly("UUID1", "UUID2"); } @@ -199,7 +200,7 @@ public class TaskFormatterTest { .setErrorStacktrace("error stacktrace") .setErrorType("anErrorType"); - WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); + Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage()); assertThat(task.getErrorStacktrace()).isEqualTo(dto.getErrorStacktrace()); @@ -211,7 +212,7 @@ public class TaskFormatterTest { CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED) .setErrorMessage("error msg"); - WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); + Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage()); assertThat(task.hasErrorStacktrace()).isFalse(); @@ -222,7 +223,7 @@ public class TaskFormatterTest { CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED) .setErrorMessage("error msg"); - WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); + Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next(); assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage()); assertThat(task.hasErrorStacktrace()).isFalse(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/WorkerCountActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/WorkerCountActionTest.java index e28f0bfe534..d7b0fb8fd68 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/WorkerCountActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/WorkerCountActionTest.java @@ -28,7 +28,7 @@ import org.sonar.ce.configuration.WorkerCountProvider; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsCe.WorkerCountResponse; +import org.sonarqube.ws.Ce.WorkerCountResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java index 3a6cc5e891b..98357f4b30c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java @@ -51,8 +51,8 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsComponents.SearchWsResponse; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Components.SearchWsResponse; import org.sonarqube.ws.client.component.SearchWsRequest; import static java.util.Arrays.asList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java index ed3a6786785..2f2a6d1ac9e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java @@ -57,8 +57,8 @@ import org.sonar.server.ws.KeyExamples; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; import static java.util.Arrays.asList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java index 6691cd3a359..bdb2229755e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java @@ -32,7 +32,6 @@ import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.db.DbTester; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.component.TestComponentFinder; import org.sonar.server.exceptions.ForbiddenException; @@ -40,8 +39,8 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsComponents.ShowWsResponse; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Components.ShowWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java index 7858f907b8f..cc706cca7cf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java @@ -50,11 +50,11 @@ import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Category; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Organization; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Project; -import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Suggestion; +import org.sonarqube.ws.Components.SuggestionsWsResponse; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Category; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Organization; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Project; +import org.sonarqube.ws.Components.SuggestionsWsResponse.Suggestion; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java index 806621bdd8a..7a1bb4d5ed7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java @@ -52,8 +52,8 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.TreeWsResponse; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Components.TreeWsResponse; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; @@ -333,9 +333,9 @@ public class TreeActionTest { .setParam(PARAM_BRANCH, branchKey) .executeProtobuf(TreeWsResponse.class); - assertThat(response.getBaseComponent()).extracting(WsComponents.Component::getKey, WsComponents.Component::getBranch) + assertThat(response.getBaseComponent()).extracting(Components.Component::getKey, Components.Component::getBranch) .containsExactlyInAnyOrder(module.getKey(), branchKey); - assertThat(response.getComponentsList()).extracting(WsComponents.Component::getKey, WsComponents.Component::getBranch) + assertThat(response.getComponentsList()).extracting(Components.Component::getKey, Components.Component::getBranch) .containsExactlyInAnyOrder( tuple(directory.getKey(), branchKey), tuple(file.getKey(), branchKey)); @@ -352,7 +352,7 @@ public class TreeActionTest { ws.newRequest() .setParam(PARAM_COMPONENT, branch.getDbKey()) - .executeProtobuf(WsComponents.ShowWsResponse.class); + .executeProtobuf(Components.ShowWsResponse.class); } @Test @@ -366,7 +366,7 @@ public class TreeActionTest { ws.newRequest() .setParam(PARAM_COMPONENT_ID, branch.uuid()) - .executeProtobuf(WsComponents.ShowWsResponse.class); + .executeProtobuf(Components.ShowWsResponse.class); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/ApplyLicenseActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/ApplyLicenseActionTest.java index 181a980a6fd..53892e9e183 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/ApplyLicenseActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/ApplyLicenseActionTest.java @@ -51,8 +51,8 @@ import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsEditions; -import org.sonarqube.ws.WsEditions.StatusResponse; +import org.sonarqube.ws.Editions; +import org.sonarqube.ws.Editions.StatusResponse; import static java.util.Collections.singleton; import static org.assertj.core.api.Assertions.assertThat; @@ -310,16 +310,16 @@ public class ApplyLicenseActionTest { TestResponse response = request.execute(); - StatusResponse parsedResponse = WsEditions.StatusResponse.parseFrom(response.getInputStream()); + StatusResponse parsedResponse = Editions.StatusResponse.parseFrom(response.getInputStream()); assertThat(parsedResponse.getInstallError()).isEqualTo(errorMessage); } private void assertResponse(TestResponse response, String expectedNextEditionKey, String expectedEditionKey, PendingStatus expectedPendingStatus) throws IOException { - StatusResponse parsedResponse = WsEditions.StatusResponse.parseFrom(response.getInputStream()); + StatusResponse parsedResponse = Editions.StatusResponse.parseFrom(response.getInputStream()); assertThat(parsedResponse.getCurrentEditionKey()).isEqualTo(expectedEditionKey); assertThat(parsedResponse.getNextEditionKey()).isEqualTo(expectedNextEditionKey); - assertThat(parsedResponse.getInstallationStatus()).isEqualTo(WsEditions.InstallationStatus.valueOf(expectedPendingStatus.toString())); + assertThat(parsedResponse.getInstallationStatus()).isEqualTo(Editions.InstallationStatus.valueOf(expectedPendingStatus.toString())); } private void setPendingLicense(PendingStatus pendingStatus) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/FormDataActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/FormDataActionTest.java index e2ce1b60347..1cd71ce83f8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/FormDataActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/FormDataActionTest.java @@ -40,7 +40,7 @@ import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsEditions.FormDataResponse; +import org.sonarqube.ws.Editions.FormDataResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/PreviewActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/PreviewActionTest.java index 8e8d0170da5..2f6438b2803 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/edition/ws/PreviewActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/edition/ws/PreviewActionTest.java @@ -45,10 +45,10 @@ import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; +import org.sonarqube.ws.Editions; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsEditions; -import org.sonarqube.ws.WsEditions.PreviewResponse; -import org.sonarqube.ws.WsEditions.PreviewStatus; +import org.sonarqube.ws.Editions.PreviewResponse; +import org.sonarqube.ws.Editions.PreviewStatus; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -233,7 +233,7 @@ public class PreviewActionTest { } private void assertResponse(TestResponse response, String expectedNextEditionKey, PreviewStatus expectedPreviewStatus) throws IOException { - PreviewResponse parsedResponse = WsEditions.PreviewResponse.parseFrom(response.getInputStream()); + PreviewResponse parsedResponse = Editions.PreviewResponse.parseFrom(response.getInputStream()); assertThat(parsedResponse.getPreviewStatus()).isEqualTo(expectedPreviewStatus); assertThat(parsedResponse.getNextEditionKey()).isEqualTo(expectedNextEditionKey); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java index 362ba23e66a..82468f874c4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java @@ -40,9 +40,9 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Component; -import org.sonarqube.ws.WsMeasures.ComponentWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Component; +import org.sonarqube.ws.Measures.ComponentWsResponse; import static java.lang.Double.parseDouble; import static java.lang.String.format; @@ -138,7 +138,7 @@ public class ComponentActionTest { assertThat(response.getComponent()).extracting(Component::getKey, Component::getBranch) .containsExactlyInAnyOrder(file.getKey(), file.getBranch()); assertThat(response.getComponent().getMeasuresList()) - .extracting(WsMeasures.Measure::getMetric, m -> parseDouble(m.getValue())) + .extracting(Measures.Measure::getMetric, m -> parseDouble(m.getValue())) .containsExactlyInAnyOrder(tuple(complexity.getKey(), measure.getValue())); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java index 692a818e36a..32bc30d6a31 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java @@ -49,8 +49,8 @@ import org.sonar.server.i18n.I18nRule; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; import static java.lang.Double.parseDouble; import static java.lang.String.format; @@ -226,7 +226,7 @@ public class ComponentTreeActionTest { assertThat(response.getComponentsList().get(0).getMeasuresList()).extracting("metric").containsOnly("coverage"); // file measures - List fileMeasures = response.getComponentsList().get(1).getMeasuresList(); + List fileMeasures = response.getComponentsList().get(1).getMeasuresList(); assertThat(fileMeasures).extracting("metric").containsOnly("ncloc", "coverage"); assertThat(fileMeasures).extracting("value").containsOnly("5", "15.5"); assertThat(response.getPeriods().getPeriodsList()).extracting("mode").containsOnly("last_version"); @@ -267,7 +267,7 @@ public class ComponentTreeActionTest { // directory measures assertThat(response.getComponentsList().get(0).getMeasuresList()).extracting("metric").containsOnly("coverage"); // file measures - List fileMeasures = response.getComponentsList().get(1).getMeasuresList(); + List fileMeasures = response.getComponentsList().get(1).getMeasuresList(); assertThat(fileMeasures).extracting("metric").containsOnly("ncloc", "coverage", "new_violations"); assertThat(fileMeasures).extracting("value").containsOnly("100", "15.5", ""); @@ -503,12 +503,12 @@ public class ComponentTreeActionTest { .setParam(PARAM_COMPONENT, file.getKey()) .setParam(PARAM_BRANCH, file.getBranch()) .setParam(PARAM_METRIC_KEYS, complexity.getKey()) - .executeProtobuf(WsMeasures.ComponentTreeWsResponse.class); + .executeProtobuf(Measures.ComponentTreeWsResponse.class); - assertThat(response.getBaseComponent()).extracting(WsMeasures.Component::getKey, WsMeasures.Component::getBranch) + assertThat(response.getBaseComponent()).extracting(Measures.Component::getKey, Measures.Component::getBranch) .containsExactlyInAnyOrder(file.getKey(), file.getBranch()); assertThat(response.getBaseComponent().getMeasuresList()) - .extracting(WsMeasures.Measure::getMetric, m -> parseDouble(m.getValue())) + .extracting(Measures.Measure::getMetric, m -> parseDouble(m.getValue())) .containsExactlyInAnyOrder(tuple(complexity.getKey(), measure.getValue())); } @@ -526,7 +526,7 @@ public class ComponentTreeActionTest { .executeProtobuf(ComponentTreeWsResponse.class); assertThat(response.getBaseComponent().getId()).isEqualTo(project.uuid()); - assertThat(response.getComponentsList()).extracting(WsMeasures.Component::getId) + assertThat(response.getComponentsList()).extracting(Measures.Component::getId) .containsExactlyInAnyOrder(file.uuid()); } @@ -594,7 +594,7 @@ public class ComponentTreeActionTest { .executeProtobuf(ComponentTreeWsResponse.class); assertThat(result.getComponentsList()) - .extracting(WsMeasures.Component::getKey, WsMeasures.Component::getRefId, WsMeasures.Component::getRefKey) + .extracting(Measures.Component::getKey, Measures.Component::getRefId, Measures.Component::getRefKey) .containsExactlyInAnyOrder(tuple(projectCopy.getKey(), project.uuid(), project.getKey())); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java index 6c846d51018..535eeb75696 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java @@ -47,9 +47,9 @@ import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Measure; -import org.sonarqube.ws.WsMeasures.SearchWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Measure; +import org.sonarqube.ws.Measures.SearchWsResponse; import static com.google.common.collect.Lists.newArrayList; import static java.util.Arrays.asList; @@ -144,7 +144,7 @@ public class SearchActionTest { assertThat(measure.getMetric()).isEqualTo("coverage"); assertThat(measure.getValue()).isEqualTo("15.5"); assertThat(measure.getPeriods().getPeriodsValueList()) - .extracting(WsMeasures.PeriodValue::getIndex, WsMeasures.PeriodValue::getValue) + .extracting(Measures.PeriodValue::getIndex, Measures.PeriodValue::getValue) .containsOnly(tuple(1, "10.0")); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java index 85940ce4dc8..73ae00a32b7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java @@ -47,9 +47,9 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common.Paging; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryMeasure; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue; +import org.sonarqube.ws.Measures.SearchHistoryResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryMeasure; +import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue; import org.sonarqube.ws.client.measure.SearchHistoryRequest; import static com.google.common.collect.Lists.newArrayList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java index 1782763fcc4..30de11db233 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java @@ -31,7 +31,7 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.i18n.I18nRule; -import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.Permissions; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.permission.GlobalPermissions.PROVISIONING; @@ -101,11 +101,11 @@ public class SearchGlobalPermissionsActionTest extends BasePermissionWsTest(nodeHealths))); - WsSystem.HealthResponse response = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class); + System.HealthResponse response = underTest.newRequest().executeProtobuf(System.HealthResponse.class); assertThat(response.getNodes().getNodesList()) - .extracting(WsSystem.Node::getStartedAt) + .extracting(System.Node::getStartedAt) .containsExactly(expected); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionTest.java index 0ee02bbd5f5..41c3d00f333 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionTest.java @@ -35,7 +35,7 @@ import org.sonar.server.user.SystemPasscode; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; @@ -128,7 +128,7 @@ public class SafeModeHealthActionTest { when(healthChecker.checkNode()).thenReturn(health); TestRequest request = underTest.newRequest(); - WsSystem.HealthResponse healthResponse = request.executeProtobuf(WsSystem.HealthResponse.class); + System.HealthResponse healthResponse = request.executeProtobuf(System.HealthResponse.class); assertThat(healthResponse.getHealth().name()).isEqualTo(randomStatus.name()); assertThat(health.getCauses()).isEqualTo(health.getCauses()); } @@ -143,10 +143,10 @@ public class SafeModeHealthActionTest { Arrays.stream(causes).forEach(healthBuilder::addCause); when(healthChecker.checkNode()).thenReturn(healthBuilder.build()); - WsSystem.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class); + System.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(System.HealthResponse.class); assertThat(clusterHealthResponse.getHealth().name()).isEqualTo(randomStatus.name()); assertThat(clusterHealthResponse.getCausesList()) - .extracting(WsSystem.Cause::getMessage) + .extracting(System.Cause::getMessage) .containsOnly(causes); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java index 1e0e6b4c4e4..0f73cbc6922 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java @@ -48,8 +48,8 @@ import org.sonar.server.measure.index.ProjectMeasuresIndexDefinition; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; -import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse.Key; +import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse.Key; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java index c420b889e80..f6039570f0d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java @@ -43,8 +43,8 @@ import org.sonar.server.permission.PermissionTemplateService; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjects.CreateWsResponse; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.client.project.CreateRequest; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java index 9f122fe9feb..b4f670a9bfa 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java @@ -45,8 +45,8 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsProjects.SearchWsResponse; -import org.sonarqube.ws.WsProjects.SearchWsResponse.Component; +import org.sonarqube.ws.Projects.SearchWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse.Component; import org.sonarqube.ws.client.component.ComponentsWsParameters; import org.sonarqube.ws.client.project.SearchWsRequest; diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java index 8c4df109c8d..fb7574edbfc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java @@ -44,8 +44,8 @@ import org.sonar.db.user.UserDto; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse; -import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Project; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Project; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY; diff --git a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java index 6b4bd5f8f2d..f1ab8b32bb3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java @@ -43,7 +43,7 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjectLinks; +import org.sonarqube.ws.ProjectLinks; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -290,12 +290,12 @@ public class CreateActionTest { } private void createAndTest(ComponentDto project, String name, String url, String type) throws IOException { - WsProjectLinks.CreateWsResponse response = ws.newRequest() + ProjectLinks.CreateWsResponse response = ws.newRequest() .setMethod("POST") .setParam(PARAM_PROJECT_KEY, project.getDbKey()) .setParam(PARAM_NAME, name) .setParam(PARAM_URL, url) - .executeProtobuf(WsProjectLinks.CreateWsResponse.class); + .executeProtobuf(ProjectLinks.CreateWsResponse.class); long newId = Long.valueOf(response.getLink().getId()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java index 79975ce4b5a..7e421fc2451 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java @@ -43,8 +43,8 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjectLinks.Link; -import org.sonarqube.ws.WsProjectLinks.SearchWsResponse; +import org.sonarqube.ws.ProjectLinks.Link; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java index 640295fd6af..0479cc5ddf4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java @@ -44,7 +44,7 @@ import org.sonar.server.permission.index.PermissionIndexerTester; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsProjectTags.SearchResponse; +import org.sonarqube.ws.ProjectTags.SearchResponse; import static com.google.common.collect.Lists.newArrayList; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java index 5e666e3fd9d..ec037e309f9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java @@ -32,7 +32,7 @@ import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsQualityGates.AppWsResponse; +import org.sonarqube.ws.Qualitygates.AppWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.api.measures.Metric.ValueType.BOOL; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateActionTest.java index 9f4c68ea2f7..66181d1f55b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateActionTest.java @@ -34,7 +34,7 @@ import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.qualitygate.QualityGateUpdater; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java index 45ad8ed38ef..01c7f67834b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java @@ -42,8 +42,7 @@ import org.sonar.server.qualitygate.QualityGateConditionsUpdater; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse; +import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.metric.MetricTesting.newMetricDto; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java index 0529e7bfc26..63879d99429 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java @@ -43,8 +43,8 @@ import org.sonar.server.qualitygate.QualityGateFinder; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsQualityGates; -import org.sonarqube.ws.WsQualityGates.GetByProjectWsResponse; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -120,7 +120,7 @@ public class GetByProjectActionTest { GetByProjectWsResponse result = callByKey(project.getKey()); - WsQualityGates.QualityGate qualityGate = result.getQualityGate(); + Qualitygates.QualityGate qualityGate = result.getQualityGate(); assertThat(Long.valueOf(qualityGate.getId())).isEqualTo(dbQualityGate.getId()); assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName()); assertThat(qualityGate.getDefault()).isTrue(); @@ -137,7 +137,7 @@ public class GetByProjectActionTest { GetByProjectWsResponse result = callByKey(project.getKey()); - WsQualityGates.QualityGate qualityGate = result.getQualityGate(); + Qualitygates.QualityGate qualityGate = result.getQualityGate(); assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName()); assertThat(qualityGate.getDefault()).isFalse(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java index 05b5ad04eba..c457670ae72 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java @@ -44,8 +44,8 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse.Status; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse.Status; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatterTest.java index 1bd630b6d04..00196c7e001 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatterTest.java @@ -28,8 +28,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.db.component.SnapshotDto; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse.ProjectStatus; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse.ProjectStatus; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.api.utils.DateUtils.formatDateTime; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java index 9f223c46fda..194ae1b1bc7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java @@ -42,8 +42,7 @@ import org.sonar.server.qualitygate.QualityGateConditionsUpdater; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse; +import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.metric.MetricTesting.newMetricDto; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java index bb1d60400d6..4a0cb167daa 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java @@ -63,8 +63,8 @@ import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java index ec5e34aa621..e9ecbd0cedc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java @@ -56,7 +56,7 @@ import org.sonar.server.rule.index.RuleIndexer; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.util.TypeValidations; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse; +import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java index f873af646b4..289ec3904f6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java @@ -48,8 +48,8 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import static java.lang.String.format; import static java.util.stream.IntStream.range; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchGroupsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchGroupsActionTest.java index de50235bc56..4f6d7280515 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchGroupsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchGroupsActionTest.java @@ -36,7 +36,7 @@ import org.sonar.server.language.LanguageTesting; import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchUsersActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchUsersActionTest.java index bcaf668c046..975af2d69e5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchUsersActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchUsersActionTest.java @@ -38,7 +38,7 @@ import org.sonar.server.language.LanguageTesting; import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.QualityProfiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java index 4ec5fb1230e..bf9cab32872 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java @@ -43,10 +43,10 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.ShowResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay; -import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile; import static java.util.stream.IntStream.range; import static org.assertj.core.api.Assertions.assertThat; @@ -104,7 +104,7 @@ public class ShowActionTest { public void profile_info() { QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey())); - QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); + Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); assertThat(result.getProfile()) .extracting(QualityProfile::getKey, QualityProfile::getName, QualityProfile::getIsBuiltIn, QualityProfile::getLanguage, QualityProfile::getLanguageName, @@ -117,7 +117,7 @@ public class ShowActionTest { QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey())); db.qualityProfiles().setAsDefault(profile); - QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); + Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); assertThat(result.getProfile().getIsDefault()).isTrue(); } @@ -142,7 +142,7 @@ public class ShowActionTest { .setLastUsed(time) .setUserUpdatedAt(time)); - QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); + Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); assertThat(result.getProfile().getRulesUpdatedAt()).isEqualTo("2016-12-21T19:10:03+0100"); assertThat(parseDateTime(result.getProfile().getLastUsed()).getTime()).isEqualTo(time); @@ -165,7 +165,7 @@ public class ShowActionTest { .mapToObj(i -> db.components().insertPrivateProject()) .forEach(project -> db.qualityProfiles().associateWithProject(project, profile)); - QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); + Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee())); assertThat(result.getProfile()) .extracting(QualityProfile::getActiveRuleCount, QualityProfile::getActiveDeprecatedRuleCount, QualityProfile::getProjectCount) @@ -240,7 +240,7 @@ public class ShowActionTest { QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey())); QProfileDto anotherBuiltInProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setLanguage(XOO1.getKey())); - QualityProfiles.ShowResponse result = call(ws.newRequest() + Qualityprofiles.ShowResponse result = call(ws.newRequest() .setParam(PARAM_KEY, anotherBuiltInProfile.getKee()) .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true")); @@ -252,7 +252,7 @@ public class ShowActionTest { QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(false).setName("Sonar way").setLanguage(XOO1.getKey())); QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey())); - QualityProfiles.ShowResponse result = call(ws.newRequest() + Qualityprofiles.ShowResponse result = call(ws.newRequest() .setParam(PARAM_KEY, profile.getKee()) .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true")); @@ -264,7 +264,7 @@ public class ShowActionTest { QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey())); QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey())); - QualityProfiles.ShowResponse result = call(ws.newRequest() + Qualityprofiles.ShowResponse result = call(ws.newRequest() .setParam(PARAM_KEY, profile.getKee()) .setParam(PARAM_COMPARE_TO_SONAR_WAY, "false")); @@ -352,6 +352,6 @@ public class ShowActionTest { private ShowResponse call(TestRequest request) { TestRequest wsRequest = request.setMediaType(MediaTypes.PROTOBUF); - return wsRequest.executeProtobuf(QualityProfiles.ShowResponse.class); + return wsRequest.executeProtobuf(Qualityprofiles.ShowResponse.class); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/root/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/root/ws/SearchActionTest.java index a47344191e7..0c7d2ef1aa1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/root/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/root/ws/SearchActionTest.java @@ -35,7 +35,7 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsRoot; +import org.sonarqube.ws.Root; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.test.JsonAssert.assertJson; @@ -112,9 +112,9 @@ public class SearchActionTest { userDao.setRoot(dbSession, rootDto.getLogin(), true); dbSession.commit(); - List roots = executeRequest(); + List roots = executeRequest(); assertThat(roots).hasSize(1); - WsRoot.Root root = roots.iterator().next(); + Root.RootContent root = roots.iterator().next(); assertThat(root.getLogin()).isEqualTo(rootDto.getLogin()); assertThat(root.hasName()).isFalse(); assertThat(root.hasEmail()).isFalse(); @@ -132,7 +132,7 @@ public class SearchActionTest { dbSession.commit(); assertThat(executeRequest()) - .extracting(WsRoot.Root::getName) + .extracting(Root.RootContent::getName) .containsExactly("bbb", "ccc"); } @@ -140,9 +140,9 @@ public class SearchActionTest { return userSessionRule.logIn().setRoot(); } - private List executeRequest() { + private List executeRequest() { return wsTester.newRequest() - .executeProtobuf(WsRoot.SearchWsResponse.class) + .executeProtobuf(Root.SearchWsResponse.class) .getRootsList(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java index 28e4986f50e..61a2a31d10b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java @@ -42,8 +42,8 @@ import org.sonar.server.test.index.TestIndexer; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsTests; -import org.sonarqube.ws.WsTests.ListResponse; +import org.sonarqube.ws.Tests; +import org.sonarqube.ws.Tests.ListResponse; import static java.lang.String.format; import static java.util.Arrays.asList; @@ -121,10 +121,10 @@ public class ListActionTest { ListResponse request = call(ws.newRequest().setParam(TEST_ID, test.getUuid())); assertThat(request.getTestsList()).hasSize(1); - WsTests.Test result = request.getTests(0); + Tests.Test result = request.getTests(0); assertThat(result.getId()).isEqualTo(test.getUuid()); assertThat(result.getName()).isEqualTo(test.getName()); - assertThat(result.getStatus()).isEqualTo(WsTests.TestStatus.OK); + assertThat(result.getStatus()).isEqualTo(Tests.TestStatus.OK); assertThat(result.getFileId()).isEqualTo(testFile.uuid()); assertThat(result.getFileKey()).isEqualTo(testFile.getDbKey()); assertThat(result.getFileName()).isEqualTo(testFile.path()); @@ -145,7 +145,7 @@ public class ListActionTest { .setParam(TEST_ID, test1.getUuid())); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId) + .extracting(Tests.Test::getId) .containsOnly(test1.getUuid()); } @@ -163,7 +163,7 @@ public class ListActionTest { .setParam(TEST_FILE_ID, testFile.uuid())); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId) + .extracting(Tests.Test::getId) .containsOnly(test1.getUuid(), test2.getUuid()); } @@ -181,7 +181,7 @@ public class ListActionTest { .setParam(TEST_FILE_KEY, testFile.getDbKey())); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId) + .extracting(Tests.Test::getId) .containsOnly(test1.getUuid(), test2.getUuid()); } @@ -202,7 +202,7 @@ public class ListActionTest { .setParam("branch", testFile.getBranch())); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId, WsTests.Test::getFileKey, WsTests.Test::getFileBranch) + .extracting(Tests.Test::getId, Tests.Test::getFileKey, Tests.Test::getFileBranch) .containsOnly( tuple(test1.getUuid(), testFile.getKey(), testFile.getBranch()), tuple(test2.getUuid(), testFile.getKey(), testFile.getBranch())); @@ -222,7 +222,7 @@ public class ListActionTest { .setParam(SOURCE_FILE_ID, mainFile.uuid()) .setParam(SOURCE_FILE_LINE_NUMBER, "11")); - assertThat(request.getTestsList()).extracting(WsTests.Test::getId).containsOnly(test1.getUuid(), test2.getUuid()); + assertThat(request.getTestsList()).extracting(Tests.Test::getId).containsOnly(test1.getUuid(), test2.getUuid()); } @Test @@ -240,7 +240,7 @@ public class ListActionTest { .setParam(SOURCE_FILE_LINE_NUMBER, "10")); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId) + .extracting(Tests.Test::getId) .containsOnly(test1.getUuid(), test3.getUuid()); } @@ -262,7 +262,7 @@ public class ListActionTest { .setParam("branch", testFile.getBranch())); assertThat(request.getTestsList()) - .extracting(WsTests.Test::getId, WsTests.Test::getFileKey, WsTests.Test::getFileBranch) + .extracting(Tests.Test::getId, Tests.Test::getFileKey, Tests.Test::getFileBranch) .containsOnly( tuple(test1.getUuid(), testFile.getKey(), testFile.getBranch()), tuple(test3.getUuid(), testFile.getKey(), testFile.getBranch())); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java index e6e6d81463a..5de4d8d7e56 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java @@ -50,8 +50,8 @@ import org.sonar.server.user.index.UserIndexer; import org.sonar.server.usergroups.DefaultGroupFinder; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsUsers.CreateWsResponse; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.user.CreateRequest; import static java.util.Collections.singletonList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java index c58427b9cf4..39c4c96d0ab 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java @@ -32,7 +32,7 @@ import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.WsUsers.CurrentWsResponse; +import org.sonarqube.ws.Users.CurrentWsResponse; import static com.google.common.collect.Lists.newArrayList; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java index a29772a55bc..27b5b06ceb1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java @@ -37,7 +37,7 @@ import org.sonar.server.usergroups.DefaultGroupFinder; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsUsers.GroupsWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse; import static java.lang.String.format; import static java.util.Collections.singletonList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/SearchActionTest.java index 0b20a89e739..fce5824fe8c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/SearchActionTest.java @@ -48,8 +48,8 @@ import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; import static org.sonar.db.user.GroupTesting.newGroupDto; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.WsUserGroups.Group; -import static org.sonarqube.ws.WsUserGroups.SearchWsResponse; +import static org.sonarqube.ws.UserGroups.Group; +import static org.sonarqube.ws.UserGroups.SearchWsResponse; public class SearchActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java index 3d305c6c8ad..2fae76356d2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java @@ -35,7 +35,7 @@ import org.sonar.server.usertoken.TokenGenerator; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsUserTokens.GenerateWsResponse; +import org.sonarqube.ws.UserTokens.GenerateWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.anyString; diff --git a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java index 04f78ea535d..eb0f1539d35 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java @@ -34,8 +34,7 @@ import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsUserTokens.SearchWsResponse; +import org.sonarqube.ws.UserTokens.SearchWsResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.user.UserTesting.newUserDto; diff --git a/server/sonar-server/src/test/java/org/sonar/server/ws/WsUtilsTest.java b/server/sonar-server/src/test/java/org/sonar/server/ws/WsUtilsTest.java index dc4bbf02452..65126a05bec 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ws/WsUtilsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ws/WsUtilsTest.java @@ -27,7 +27,7 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.server.exceptions.BadRequestException; import org.sonarqube.ws.Issues; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.Permissions; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.test.ExceptionCauseMatcher.hasType; @@ -73,7 +73,7 @@ public class WsUtilsTest { TestRequest request = new TestRequest(); request.setMediaType(MediaTypes.PROTOBUF); - WsPermissions.Permission message = WsPermissions.Permission.newBuilder().setName("permission-name").build(); + Permissions.Permission message = Permissions.Permission.newBuilder().setName("permission-name").build(); expectedException.expect(IllegalStateException.class); expectedException.expectCause(hasType(NullPointerException.class)); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index c9b3b951898..a07e3e36b13 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -48,8 +48,8 @@ import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.output.ScannerReportWriter; import org.sonar.scanner.scan.branch.BranchConfiguration; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsCe; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsResponse; @@ -192,7 +192,7 @@ public class ReportPublisher implements Startable { } try (InputStream protobuf = response.contentStream()) { - return WsCe.SubmitResponse.parser().parseFrom(protobuf).getTaskId(); + return Ce.SubmitResponse.parser().parseFrom(protobuf).getTaskId(); } catch (Exception e) { throw Throwables.propagate(e); } finally { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java index ca0ba4da7e0..a97af0ebc43 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java @@ -34,10 +34,10 @@ import org.slf4j.LoggerFactory; import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.util.ScannerUtils; -import org.sonarqube.ws.WsBatch; -import org.sonarqube.ws.WsBatch.WsProjectResponse; -import org.sonarqube.ws.WsBatch.WsProjectResponse.FileDataByPath; -import org.sonarqube.ws.WsBatch.WsProjectResponse.Settings; +import org.sonarqube.ws.Batch; +import org.sonarqube.ws.Batch.WsProjectResponse; +import org.sonarqube.ws.Batch.WsProjectResponse.FileDataByPath; +import org.sonarqube.ws.Batch.WsProjectResponse.Settings; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.WsResponse; @@ -111,7 +111,7 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad Map fileDataByModuleAndPath = response.getFileDataByModuleAndPath(); for (Map.Entry e1 : fileDataByModuleAndPath.entrySet()) { - for (Map.Entry e2 : e1.getValue().getFileDataByPath().entrySet()) { + for (Map.Entry e2 : e1.getValue().getFileDataByPath().entrySet()) { FileData fd = new FileData(e2.getValue().getHash(), e2.getValue().getRevision()); fileDataTable.put(e1.getKey(), e2.getKey(), fd); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java index 779174757d4..f46b5d5b77f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java @@ -32,8 +32,8 @@ import org.apache.commons.io.IOUtils; import org.sonar.api.config.Configuration; import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import org.sonarqube.ws.client.GetRequest; import static java.util.function.Function.identity; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileLoader.java index 96394c57c41..6a7416434d3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileLoader.java @@ -21,7 +21,7 @@ package org.sonar.scanner.repository; import java.util.List; import javax.annotation.Nullable; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; public interface QualityProfileLoader { List load(String projectKey, @Nullable String profileName); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileProvider.java index 076e363f7b7..60be7b5140e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfileProvider.java @@ -28,7 +28,7 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; import org.sonar.scanner.analysis.AnalysisProperties; import org.sonar.scanner.rule.ModuleQProfiles; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; public class QualityProfileProvider extends ProviderAdapter { private static final Logger LOG = Loggers.get(QualityProfileProvider.class); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ModuleQProfiles.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ModuleQProfiles.java index 30d87568514..fc26ce4fe36 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ModuleQProfiles.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ModuleQProfiles.java @@ -21,7 +21,7 @@ package org.sonar.scanner.rule; import org.sonar.api.utils.DateUtils; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import org.sonar.api.batch.ScannerSide; import javax.annotation.CheckForNull; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java index 430ab5dc62a..618ce7fdf58 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java @@ -72,7 +72,7 @@ import org.sonar.scanner.scan.branch.BranchConfiguration; import org.sonar.scanner.scan.branch.BranchConfigurationLoader; import org.sonar.scanner.scan.branch.BranchType; import org.sonar.scanner.scan.branch.ProjectBranches; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import org.sonarqube.ws.Rules.ListResponse.Rule; /** diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java index 7309c43975c..ba4f3ba03e7 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java @@ -47,7 +47,7 @@ import org.sonar.core.config.ScannerProperties; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.scan.branch.BranchConfiguration; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; @@ -213,7 +213,7 @@ public class ReportPublisherTest { PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(out); - WsCe.SubmitResponse.newBuilder().build().writeTo(out); + Ce.SubmitResponse.newBuilder().build().writeTo(out); out.close(); when(response.failIfNotSuccessful()).thenReturn(response); @@ -247,7 +247,7 @@ public class ReportPublisherTest { PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(out); - WsCe.SubmitResponse.newBuilder().build().writeTo(out); + Ce.SubmitResponse.newBuilder().build().writeTo(out); out.close(); when(response.failIfNotSuccessful()).thenReturn(response); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java index abb528b202d..c8009a9a116 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java @@ -31,7 +31,7 @@ import org.junit.rules.ExpectedException; import org.sonar.api.utils.MessageException; import org.sonar.scanner.WsTestUtil; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonarqube.ws.WsBatch.WsProjectResponse; +import org.sonarqube.ws.Batch.WsProjectResponse; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.WsRequest; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java index c02c6d05a40..0ed0aa9c2a4 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java @@ -30,8 +30,8 @@ import org.sonar.api.config.internal.MapSettings; import org.sonar.api.utils.MessageException; import org.sonar.scanner.WsTestUtil; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -128,7 +128,7 @@ public class DefaultQualityProfileLoaderTest { private static InputStream createStreamOfProfiles(String... names) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); - QualityProfiles.SearchWsResponse.Builder responseBuilder = QualityProfiles.SearchWsResponse.newBuilder(); + Qualityprofiles.SearchWsResponse.Builder responseBuilder = Qualityprofiles.SearchWsResponse.newBuilder(); for (String n : names) { QualityProfile qp = QualityProfile.newBuilder().setKey(n).setName(n).setLanguage("lang").build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java index 255e008b6d7..43a4ecbaaad 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java @@ -34,7 +34,7 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.scanner.analysis.AnalysisProperties; import org.sonar.scanner.rule.ModuleQProfiles; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.anyString; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java index 5091ea813fd..9b2edb814a6 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java @@ -30,7 +30,7 @@ import org.mockito.MockitoAnnotations; import org.sonar.api.batch.rule.ActiveRules; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.DateUtils; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.eq; diff --git a/sonar-ws-generated/pom.xml b/sonar-ws-generated/pom.xml new file mode 100644 index 00000000000..2ca3fb6bb68 --- /dev/null +++ b/sonar-ws-generated/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + + org.sonarsource.sonarqube + sonarqube + 7.0-SNAPSHOT + + + sonar-ws-generated + SonarQube :: Web Service :: Generated + Generated classes for Web Services + + + src/main/**/* + src/main/**/* + + + + + com.google.protobuf + protobuf-java + + + com.google.guava + guava + + + com.google.code.findbugs + jsr305 + provided + + + commons-io + commons-io + + + org.sonarsource.sonarqube + sonar-plugin-api + provided + true + + + + + junit + junit + test + + + org.assertj + assertj-core + test + + + org.mockito + mockito-core + test + + + ${project.groupId} + sonar-testing-harness + ${project.version} + test + + + com.squareup.okhttp3 + mockwebserver + test + + + commons-lang + commons-lang + test + + + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/MediaTypes.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/MediaTypes.java new file mode 100644 index 00000000000..08783ca593e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/MediaTypes.java @@ -0,0 +1,85 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableMap; +import java.util.Locale; +import java.util.Map; +import org.apache.commons.io.FilenameUtils; + +/** + * @since 5.3 + */ +public final class MediaTypes { + + public static final String JSON = "application/json"; + public static final String XML = "application/xml"; + public static final String TXT = "text/plain"; + public static final String PROTOBUF = "application/x-protobuf"; + public static final String ZIP = "application/zip"; + public static final String JAVASCRIPT = "application/javascript"; + public static final String HTML = "text/html"; + public static final String DEFAULT = "application/octet-stream"; + + private static final Map MAP = new ImmutableMap.Builder() + .put("js", JAVASCRIPT) + .put("json", JSON) + .put("zip", "application/zip") + .put("tgz", "application/tgz") + .put("ps", "application/postscript") + .put("jnlp", "application/jnlp") + .put("jar", "application/java-archive") + .put("xls", "application/vnd.ms-excel") + .put("ppt", "application/vnd.ms-powerpoint") + .put("tar", "application/x-tar") + .put("xml", XML) + .put("dtd", "application/xml-dtd") + .put("xslt", "application/xslt+xml") + .put("bmp", "image/bmp") + .put("gif", "image/gif") + .put("jpg", "image/jpeg") + .put("jpeg", "image/jpeg") + .put("tiff", "image/tiff") + .put("png", "image/png") + .put("svg", "image/svg+xml") + .put("ico", "image/x-icon") + .put("txt", TXT) + .put("csv", "text/csv") + .put("properties", "text/plain") + .put("rtf", "text/rtf") + .put("html", HTML) + .put("css", "text/css") + .put("tsv", "text/tab-separated-values") + .build(); + + private MediaTypes() { + // only static methods + } + + public static String getByFilename(String filename) { + String extension = FilenameUtils.getExtension(filename); + String mime = null; + if (!Strings.isNullOrEmpty(extension)) { + mime = MAP.get(extension.toLowerCase(Locale.ENGLISH)); + } + return mime != null ? mime : DEFAULT; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseRequest.java new file mode 100644 index 00000000000..8b5fbcff005 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseRequest.java @@ -0,0 +1,211 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.common.collect.LinkedListMultimap; +import com.google.common.collect.ListMultimap; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.sonarqube.ws.MediaTypes; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.isNullOrEmpty; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableSet; +import static java.util.Objects.requireNonNull; + +abstract class BaseRequest implements WsRequest { + + private final String path; + + private String mediaType = MediaTypes.JSON; + + private final DefaultParameters parameters = new DefaultParameters(); + private final DefaultHeaders headers = new DefaultHeaders(); + + BaseRequest(String path) { + this.path = path; + } + + @Override + public String getPath() { + return path; + } + + @Override + public String getMediaType() { + return mediaType; + } + + /** + * Expected media type of response. Default is {@link MediaTypes#JSON}. + */ + public SELF setMediaType(String s) { + requireNonNull(s, "media type of response cannot be null"); + this.mediaType = s; + return (SELF) this; + } + + public SELF setParam(String key, @Nullable String value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Integer value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Long value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Float value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Boolean value) { + return setSingleValueParam(key, value); + } + + private SELF setSingleValueParam(String key, @Nullable Object value) { + checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); + if (value == null) { + return (SELF) this; + } + parameters.setValue(key, value.toString()); + + return (SELF) this; + } + + public SELF setParam(String key, @Nullable Collection values) { + checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); + if (values == null || values.isEmpty()) { + return (SELF) this; + } + + parameters.setValues(key, values.stream() + .filter(Objects::nonNull) + .map(Object::toString) + .filter(value -> !value.isEmpty()) + .collect(Collectors.toList())); + + return (SELF) this; + } + + @Override + public Map getParams() { + return parameters.keyValues.keySet().stream() + .collect(Collectors.toMap( + Function.identity(), + key -> parameters.keyValues.get(key).get(0), + (v1, v2) -> { + throw new IllegalStateException(String.format("Duplicate key '%s' in request", v1)); + }, + LinkedHashMap::new)); + } + + @Override + public Parameters getParameters() { + return parameters; + } + + @Override + public Headers getHeaders() { + return headers; + } + + public SELF setHeader(String name, @Nullable String value) { + requireNonNull(name, "Header name can't be null"); + headers.setValue(name, value); + return (SELF) this; + } + + private static class DefaultParameters implements Parameters { + // preserve insertion order + private final ListMultimap keyValues = LinkedListMultimap.create(); + + @Override + @CheckForNull + public String getValue(String key) { + return keyValues.containsKey(key) ? keyValues.get(key).get(0) : null; + } + + @Override + public List getValues(String key) { + return keyValues.get(key); + } + + @Override + public Set getKeys() { + return keyValues.keySet(); + } + + private DefaultParameters setValue(String key, String value) { + checkArgument(!isNullOrEmpty(key)); + checkArgument(value != null); + + keyValues.putAll(key, singletonList(value)); + return this; + } + + private DefaultParameters setValues(String key, Collection values) { + checkArgument(!isNullOrEmpty(key)); + checkArgument(values != null && !values.isEmpty()); + + this.keyValues.putAll(key, values.stream().map(Object::toString).filter(Objects::nonNull).collect(Collectors.toList())); + + return this; + } + } + + private static class DefaultHeaders implements Headers { + private final Map keyValues = new HashMap<>(); + + @Override + public Optional getValue(String name) { + return Optional.ofNullable(keyValues.get(name)); + } + + private DefaultHeaders setValue(String name, @Nullable String value) { + checkArgument(!isNullOrEmpty(name)); + + if (value == null) { + keyValues.remove(name); + } else { + keyValues.put(name, value); + } + return this; + } + + @Override + public Set getNames() { + return unmodifiableSet(keyValues.keySet()); + } + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseResponse.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseResponse.java new file mode 100644 index 00000000000..039754f8571 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseResponse.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import static java.net.HttpURLConnection.HTTP_NO_CONTENT; + +abstract class BaseResponse implements WsResponse { + + @Override + public boolean isSuccessful() { + return code() >= 200 && code() < 300; + } + + @Override + public WsResponse failIfNotSuccessful() { + if (!isSuccessful()) { + String content = content(); + close(); + throw new HttpException(requestUrl(), code(), content); + } + return this; + } + + @Override + public boolean hasContent() { + return code() != HTTP_NO_CONTENT; + } + + @Override + public void close() { + // override if needed + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseService.java new file mode 100644 index 00000000000..4c6a0e9449e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/BaseService.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.protobuf.Message; +import com.google.protobuf.Parser; +import java.io.InputStream; +import java.util.Collection; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.apache.commons.io.IOUtils; +import org.sonarqube.ws.MediaTypes; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.isNullOrEmpty; + +public abstract class BaseService { + + private final WsConnector wsConnector; + protected final String controller; + + public BaseService(WsConnector wsConnector, String controllerPath) { + checkArgument(!isNullOrEmpty(controllerPath)); + this.wsConnector = wsConnector; + this.controller = controllerPath; + } + + protected T call(BaseRequest request, Parser parser) { + request.setMediaType(MediaTypes.PROTOBUF); + WsResponse response = call(request); + return convert(response, parser); + } + + protected WsResponse call(WsRequest request) { + return wsConnector.call(request).failIfNotSuccessful(); + } + + public T convert(WsResponse response, Parser parser) { + try (InputStream byteStream = response.contentStream()) { + byte[] bytes = IOUtils.toByteArray(byteStream); + // HTTP header "Content-Type" is not verified. It may be different than protobuf. + return parser.parseFrom(bytes); + } catch (Exception e) { + throw new IllegalStateException("Fail to parse protobuf response of " + response.requestUrl(), e); + } + } + + protected String path(String action) { + return String.format("%s/%s", controller, action); + } + + @CheckForNull + protected static String inlineMultipleParamValue(@Nullable Collection values) { + return values == null ? null : String.join(",", values); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/GetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/GetRequest.java new file mode 100644 index 00000000000..02a1f2ac32f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/GetRequest.java @@ -0,0 +1,34 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public class GetRequest extends BaseRequest { + public GetRequest(String path) { + super(path); + } + + @Override + public Method getMethod() { + return Method.GET; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Headers.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Headers.java new file mode 100644 index 00000000000..b289789a1f2 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Headers.java @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.Optional; +import java.util.Set; + +/** + * HTTP headers + * + * @since 6.6 + */ +public interface Headers { + + Optional getValue(String name); + + Set getNames(); + +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/HttpException.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/HttpException.java new file mode 100644 index 00000000000..d456faeb473 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/HttpException.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public class HttpException extends RuntimeException { + + private final String url; + private final int code; + private final String content; + + public HttpException(String url, int code, String content) { + super(String.format("Error %d on %s : %s", code, url, content)); + this.url = url; + this.code = code; + this.content = content; + } + + public String content() { + return content; + } + + public String url() { + return url; + } + + /** + * @see java.net.HttpURLConnection constants + */ + public int code() { + return code; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Parameters.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Parameters.java new file mode 100644 index 00000000000..ae692ab103f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/Parameters.java @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.List; +import java.util.Set; +import javax.annotation.CheckForNull; + +public interface Parameters { + /** + * In the case of a multi value parameter, returns the first element + */ + @CheckForNull + String getValue(String key); + + List getValues(String key); + + Set getKeys(); +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/PostRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/PostRequest.java new file mode 100644 index 00000000000..13cbdd5c996 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/PostRequest.java @@ -0,0 +1,69 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @since 5.3 + */ +public class PostRequest extends BaseRequest { + + private final Map parts = new LinkedHashMap<>(); + + public PostRequest(String path) { + super(path); + } + + @Override + public Method getMethod() { + return Method.POST; + } + + public PostRequest setPart(String name, Part part) { + this.parts.put(name, part); + return this; + } + + public Map getParts() { + return parts; + } + + public static class Part { + private final String mediaType; + private final File file; + + public Part(String mediaType, File file) { + this.mediaType = mediaType; + this.file = file; + } + + public String getMediaType() { + return mediaType; + } + + public File getFile() { + return file; + } + } + +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsConnector.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsConnector.java new file mode 100644 index 00000000000..b203d18be98 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsConnector.java @@ -0,0 +1,40 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public interface WsConnector { + + /** + * Server base URL, always with trailing slash, for instance "http://localhost:9000/" + */ + String baseUrl(); + + /** + * @throws IllegalStateException if the request could not be executed due to + * a connectivity problem or timeout. Because networks can + * fail during an exchange, it is possible that the remote server + * accepted the request before the failure + */ + WsResponse call(WsRequest wsRequest); + +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsRequest.java new file mode 100644 index 00000000000..9907ae7b39e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.Map; + +/** + * @since 5.3 + */ +public interface WsRequest { + + Method getMethod(); + + String getPath(); + + String getMediaType(); + + /** + * + * In case of multi value parameters, returns the first value + * + * @deprecated since 6.1. Use {@link #getParameters()} instead + */ + @Deprecated + Map getParams(); + + Parameters getParameters(); + + Headers getHeaders(); + + enum Method { + GET, POST + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsResponse.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsResponse.java new file mode 100644 index 00000000000..fcaed89123f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/WsResponse.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.io.Closeable; +import java.io.InputStream; +import java.io.Reader; + +/** + * @since 5.3 + */ +public interface WsResponse extends Closeable { + + /** + * The absolute requested URL + */ + String requestUrl(); + + /** + * HTTP status code + */ + int code(); + + /** + * Returns true if the code is in [200..300), which means the request was + * successfully received, understood, and accepted. + */ + boolean isSuccessful() ; + + /** + * Throws a {@link HttpException} if {@link #isSuccessful()} is false. + */ + WsResponse failIfNotSuccessful(); + + String contentType(); + + boolean hasContent(); + + InputStream contentStream(); + + Reader contentReader(); + + String content(); + + @Override + void close(); + +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java new file mode 100644 index 00000000000..c60120c1e69 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.analysisreports; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get details about Compute Engine tasks. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AnalysisReportsService extends BaseService { + + public AnalysisReportsService(WsConnector wsConnector) { + super(wsConnector, "api/analysis_reports"); + } + + /** + * Check if the queue of Compute Engine is empty + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String isQueueEmpty() { + return call( + new GetRequest(path("is_queue_empty")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java new file mode 100644 index 00000000000..126c8ae900c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.analysisreports; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java new file mode 100644 index 00000000000..bf374421558 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java @@ -0,0 +1,87 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.authentication; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Handle authentication. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AuthenticationService extends BaseService { + + public AuthenticationService(WsConnector wsConnector) { + super(wsConnector, "api/authentication"); + } + + /** + * Authenticate a user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ + public void login(LoginRequest request) { + call( + new PostRequest(path("login")) + .setParam("login", request.getLogin()) + .setParam("password", request.getPassword()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Logout a user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void logout() { + call( + new PostRequest(path("logout")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Check credentials. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 3.3 + */ + public String validate() { + return call( + new GetRequest(path("validate")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java new file mode 100644 index 00000000000..956216ea3ef --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.authentication; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Authenticate a user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class LoginRequest { + + private String login; + private String password; + + /** + * Login of the user + * + * This is a mandatory parameter. + */ + public LoginRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Password of the user + * + * This is a mandatory parameter. + */ + public LoginRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/package-info.java new file mode 100644 index 00000000000..61fd208d68c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/authentication/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.authentication; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/BatchService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/BatchService.java new file mode 100644 index 00000000000..410d569803c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/BatchService.java @@ -0,0 +1,105 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import javax.annotation.Generated; +import org.sonarqube.ws.Batch.WsProjectResponse; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get JAR files and referentials for batch + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BatchService extends BaseService { + + public BatchService(WsConnector wsConnector) { + super(wsConnector, "batch"); + } + + /** + * Download a JAR file listed in the index (see batch/index) + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String file(FileRequest request) { + return call( + new GetRequest(path("file")) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the JAR files to be downloaded by scanners + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Return open issues + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String issues(IssuesRequest request) { + return call( + new GetRequest(path("issues")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Return project repository + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ + public WsProjectResponse project(ProjectRequest request) { + return call( + new GetRequest(path("project")) + .setParam("branch", request.getBranch()) + .setParam("issues_mode", request.getIssuesMode()) + .setParam("key", request.getKey()) + .setParam("profile", request.getProfile()), + WsProjectResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java new file mode 100644 index 00000000000..9e7a04cb3f8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Download a JAR file listed in the index (see batch/index) + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class FileRequest { + + private String name; + + /** + * File name + * + * Example value: "batch-library-2.3.jar" + */ + public FileRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java new file mode 100644 index 00000000000..8b5a5a50e95 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return open issues + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IssuesRequest { + + private String branch; + private String key; + + /** + * Branch key + * + * Example value: "feature/my_branch" + */ + public IssuesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Project, module or file key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public IssuesRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java new file mode 100644 index 00000000000..8d148f992c4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java @@ -0,0 +1,103 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return project repository + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectRequest { + + private String branch; + private String issuesMode; + private String key; + private String profile; + + /** + * Branch key + * + * Example value: "feature/my_branch" + */ + public ProjectRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Issues mode or not + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public ProjectRequest setIssuesMode(String issuesMode) { + this.issuesMode = issuesMode; + return this; + } + + public String getIssuesMode() { + return issuesMode; + } + + /** + * Project or module key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public ProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Profile name + * + * Example value: "SonarQube Way" + */ + public ProjectRequest setProfile(String profile) { + this.profile = profile; + return this; + } + + public String getProfile() { + return profile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/package-info.java new file mode 100644 index 00000000000..53ebb046e2e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/batch/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.batch; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java new file mode 100644 index 00000000000..9fda0dc7fb7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java @@ -0,0 +1,207 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for tasks.
Requires the system administration permission, or project administration permission if componentId is set. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ActivityRequest { + + private String componentId; + private String componentQuery; + private String maxExecutedAt; + private String minSubmittedAt; + private String onlyCurrents; + private String p; + private String ps; + private String q; + private List status; + private String type; + + /** + * Id of the component (project) to filter on + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivityRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Limit search to:
  • component names that contain the supplied string
  • component keys that are exactly the same as the supplied string
Must not be set together with componentId.
Deprecated and replaced by 'q' + * + * Example value: "Apache" + * @deprecated since 5.5 + */ + @Deprecated + public ActivityRequest setComponentQuery(String componentQuery) { + this.componentQuery = componentQuery; + return this; + } + + public String getComponentQuery() { + return componentQuery; + } + + /** + * Maximum date of end of task processing (inclusive) + * + * Example value: "2017-11-16T10:21:24+0100" + */ + public ActivityRequest setMaxExecutedAt(String maxExecutedAt) { + this.maxExecutedAt = maxExecutedAt; + return this; + } + + public String getMaxExecutedAt() { + return maxExecutedAt; + } + + /** + * Minimum date of task submission (inclusive) + * + * Example value: "2017-11-16T10:21:24+0100" + */ + public ActivityRequest setMinSubmittedAt(String minSubmittedAt) { + this.minSubmittedAt = minSubmittedAt; + return this; + } + + public String getMinSubmittedAt() { + return minSubmittedAt; + } + + /** + * Filter on the last tasks (only the most recent finished task by project) + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public ActivityRequest setOnlyCurrents(String onlyCurrents) { + this.onlyCurrents = onlyCurrents; + return this; + } + + public String getOnlyCurrents() { + return onlyCurrents; + } + + /** + * Deprecated parameter + * + * @deprecated since 5.5 + */ + @Deprecated + public ActivityRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 1000 + * + * Example value: "20" + */ + public ActivityRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
  • component names that contain the supplied string
  • component keys that are exactly the same as the supplied string
  • task ids that are exactly the same as the supplied string
Must not be set together with componentId + * + * Example value: "Apache" + */ + public ActivityRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma separated list of task statuses + * + * Example value: "IN_PROGRESS,SUCCESS" + * Possible values: + *
    + *
  • "SUCCESS"
  • + *
  • "FAILED"
  • + *
  • "CANCELED"
  • + *
  • "PENDING"
  • + *
  • "IN_PROGRESS"
  • + *
+ */ + public ActivityRequest setStatus(List status) { + this.status = status; + return this; + } + + public List getStatus() { + return status; + } + + /** + * Task type + * + * Example value: "REPORT" + * Possible values: + *
    + *
  • "REPORT"
  • + *
+ */ + public ActivityRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java new file mode 100644 index 00000000000..487aac0cd03 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return CE activity related metrics.
Requires 'Administer System' permission or 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ActivityStatusRequest { + + private String componentId; + private String componentKey; + + /** + * Id of the component (project) to filter on + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivityStatusRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Key of the component (project) to filter on + * + * Example value: "my_project" + */ + public ActivityStatusRequest setComponentKey(String componentKey) { + this.componentKey = componentKey; + return this; + } + + public String getComponentKey() { + return componentKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java new file mode 100644 index 00000000000..fc08cbf5478 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Cancels a pending task.
In-progress tasks cannot be canceled.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the project related to the task
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CancelRequest { + + private String id; + + /** + * Id of the task to cancel. + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CancelRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CeService.java new file mode 100644 index 00000000000..fc1dfa78c56 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/CeService.java @@ -0,0 +1,198 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Ce.ActivityResponse; +import org.sonarqube.ws.Ce.ActivityStatusWsResponse; +import org.sonarqube.ws.Ce.SubmitResponse; +import org.sonarqube.ws.Ce.TaskResponse; +import org.sonarqube.ws.Ce.TaskTypesWsResponse; +import org.sonarqube.ws.Ce.WorkerCountResponse; + +/** + * Get information on Compute Engine tasks. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CeService extends BaseService { + + public CeService(WsConnector wsConnector) { + super(wsConnector, "api/ce"); + } + + /** + * Search for tasks.
Requires the system administration permission, or project administration permission if componentId is set. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public ActivityResponse activity(ActivityRequest request) { + return call( + new GetRequest(path("activity")) + .setParam("componentId", request.getComponentId()) + .setParam("componentQuery", request.getComponentQuery()) + .setParam("maxExecutedAt", request.getMaxExecutedAt()) + .setParam("minSubmittedAt", request.getMinSubmittedAt()) + .setParam("onlyCurrents", request.getOnlyCurrents()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(","))) + .setParam("type", request.getType()), + ActivityResponse.parser()); + } + + /** + * Return CE activity related metrics.
Requires 'Administer System' permission or 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ + public ActivityStatusWsResponse activityStatus(ActivityStatusRequest request) { + return call( + new GetRequest(path("activity_status")) + .setParam("componentId", request.getComponentId()) + .setParam("componentKey", request.getComponentKey()), + ActivityStatusWsResponse.parser()); + } + + /** + * Cancels a pending task.
In-progress tasks cannot be canceled.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the project related to the task
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void cancel(CancelRequest request) { + call( + new PostRequest(path("cancel")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Cancels all pending tasks. Requires system administration permission. In-progress tasks are not canceled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void cancelAll() { + call( + new PostRequest(path("cancel_all")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).
Requires the following permission: 'Browse' on the specified component.
Either 'componentId' or 'component' must be provided. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public SubmitResponse submit(SubmitRequest request) { + return call( + new PostRequest(path("submit")) + .setParam("characteristic", request.getCharacteristic()) + .setParam("organization", request.getOrganization()) + .setParam("projectBranch", request.getProjectBranch()) + .setParam("projectKey", request.getProjectKey()) + .setParam("projectName", request.getProjectName()) + .setParam("report", request.getReport()), + SubmitResponse.parser()); + } + + /** + * Give Compute Engine task details such as type, status, duration and associated component.
Requires 'Administer System' or 'Execute Analysis' permission.
Since 6.1, field "logs" is deprecated and its value is always false. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public TaskResponse task(TaskRequest request) { + return call( + new GetRequest(path("task")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("id", request.getId()), + TaskResponse.parser()); + } + + /** + * List available task types + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ + public TaskTypesWsResponse taskTypes() { + return call( + new GetRequest(path("task_types")), + TaskTypesWsResponse.parser()); + } + + /** + * Return number of Compute Engine workers.
Requires the system administration permission + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.5 + */ + public WorkerCountResponse workerCount() { + return call( + new GetRequest(path("worker_count")), + WorkerCountResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java new file mode 100644 index 00000000000..5da28f28dcc --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java @@ -0,0 +1,64 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).
Requires the following permission: 'Browse' on the specified component.
Either 'componentId' or 'component' must be provided. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentRequest { + + private String component; + private String componentId; + + /** + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java new file mode 100644 index 00000000000..dccee4d7298 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SubmitRequest { + + private String characteristic; + private String organization; + private String projectBranch; + private String projectKey; + private String projectName; + private String report; + + /** + * Optional characteristic of the analysis. Can be repeated to define multiple characteristics. + * + * Example value: "branchType=long" + */ + public SubmitRequest setCharacteristic(String characteristic) { + this.characteristic = characteristic; + return this; + } + + public String getCharacteristic() { + return characteristic; + } + + /** + * Key of the organization the project belongs to + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SubmitRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Optional branch of project + * + * Example value: "branch-1.x" + */ + public SubmitRequest setProjectBranch(String projectBranch) { + this.projectBranch = projectBranch; + return this; + } + + public String getProjectBranch() { + return projectBranch; + } + + /** + * Key of project + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SubmitRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Optional name of the project, used only if the project does not exist yet. + * + * Example value: "My Project" + */ + public SubmitRequest setProjectName(String projectName) { + this.projectName = projectName; + return this; + } + + public String getProjectName() { + return projectName; + } + + /** + * Report file. Format is not an API, it changes among SonarQube versions. + * + * This is a mandatory parameter. + */ + public SubmitRequest setReport(String report) { + this.report = report; + return this; + } + + public String getReport() { + return report; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java new file mode 100644 index 00000000000..a3f492c315d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Give Compute Engine task details such as type, status, duration and associated component.
Requires 'Administer System' or 'Execute Analysis' permission.
Since 6.1, field "logs" is deprecated and its value is always false. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TaskRequest { + + private List additionalFields; + private String id; + + /** + * Comma-separated list of the optional fields to be returned in response. + * + * Possible values: + *
    + *
  • "stacktrace"
  • + *
  • "scannerContext"
  • + *
+ */ + public TaskRequest setAdditionalFields(List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List getAdditionalFields() { + return additionalFields; + } + + /** + * Id of task + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TaskRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/package-info.java new file mode 100644 index 00000000000..9971fa2fd54 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/ce/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.ce; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/AppRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/AppRequest.java new file mode 100644 index 00000000000..961d7392f0f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/AppRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Coverage data required for rendering the component viewer.
Requires the following permission: 'Browse'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AppRequest { + + private String branch; + private String component; + private String componentId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public AppRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public AppRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component ID + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public AppRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java new file mode 100644 index 00000000000..4e4980c8c3e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java @@ -0,0 +1,163 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Components.SearchWsResponse; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.ShowWsResponse; +import org.sonarqube.ws.Components.SuggestionsWsResponse; +import org.sonarqube.ws.Components.TreeWsResponse; + +/** + * Get information about a component (file, directory, project, ...) and its ancestors or descendants. Update a project or module key. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentsService extends BaseService { + + public ComponentsService(WsConnector wsConnector) { + super(wsConnector, "api/components"); + } + + /** + * Coverage data required for rendering the component viewer.
Requires the following permission: 'Browse'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String app(AppRequest request) { + return call( + new GetRequest(path("app")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for components + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Search for projects + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) { + return call( + new GetRequest(path("search_projects")) + .setParam("asc", request.getAsc()) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("filter", request.getFilter()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("s", request.getS()), + SearchProjectsWsResponse.parser()); + } + + /** + * Returns a component (file, directory, project, view…) and its ancestors. The ancestors are ordered from the parent to the root project. The 'componentId' or 'component' parameter must be provided.
Requires the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ + public ShowWsResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()), + ShowWsResponse.parser()); + } + + /** + * Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.

Each result contains:

  • the organization key
  • the component key
  • the component's name (unescaped)
  • optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ + public SuggestionsWsResponse suggestions(SuggestionsRequest request) { + return call( + new GetRequest(path("suggestions")) + .setParam("more", request.getMore()) + .setParam("recentlyBrowsed", request.getRecentlyBrowsed() == null ? null : request.getRecentlyBrowsed().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS()), + SuggestionsWsResponse.parser()); + } + + /** + * Navigate through components based on the chosen strategy. The componentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the specified project.
When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ + public TreeWsResponse tree(TreeRequest request) { + return call( + new GetRequest(path("tree")) + .setParam("asc", request.getAsc()) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS() == null ? null : request.getS().stream().collect(Collectors.joining(","))) + .setParam("strategy", request.getStrategy()), + TreeWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java new file mode 100644 index 00000000000..42a387da243 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java @@ -0,0 +1,201 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for projects + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchProjectsRequest { + + private String asc; + private List f; + private List facets; + private String filter; + private String organization; + private String p; + private String ps; + private String s; + + /** + * Ascending sort + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchProjectsRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Comma-separated list of the fields to be returned in response + * + * Possible values: + *
    + *
  • "analysisDate"
  • + *
  • "leakPeriodDate"
  • + *
+ */ + public SearchProjectsRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default. + * + * Possible values: + *
    + *
  • "alert_status"
  • + *
  • "coverage"
  • + *
  • "duplicated_lines_density"
  • + *
  • "languages"
  • + *
  • "ncloc"
  • + *
  • "new_coverage"
  • + *
  • "new_duplicated_lines_density"
  • + *
  • "new_lines"
  • + *
  • "new_maintainability_rating"
  • + *
  • "new_reliability_rating"
  • + *
  • "new_security_rating"
  • + *
  • "reliability_rating"
  • + *
  • "security_rating"
  • + *
  • "sqale_rating"
  • + *
  • "tags"
  • + *
+ */ + public SearchProjectsRequest setFacets(List facets) { + this.facets = facets; + return this; + } + + public List getFacets() { + return facets; + } + + /** + * Filter of projects on name, key, measure value, quality gate, language, tag or whether a project is a favorite or not.
The filter must be encoded to form a valid URL (for example '=' must be replaced by '%3D').
Examples of use:
  • to filter my favorite projects with a failed quality gate and a coverage greater than or equals to 60% and a coverage strictly lower than 80%:
    filter="alert_status = ERROR and isFavorite and coverage >= 60 and coverage < 80"
  • to filter projects with a reliability, security and maintainability rating equals or worse than B:
    filter="reliability_rating>=2 and security_rating>=2 and sqale_rating>=2"
  • to filter projects without duplication data:
    filter="duplicated_lines_density = NO_DATA"
To filter on project name or key, use the 'query' keyword, for instance : filter='query = "Sonar"'.

To filter on a numeric metric, provide the metric key.
These are the supported metric keys:
  • alert_status
  • coverage
  • duplicated_lines_density
  • lines
  • ncloc
  • ncloc_language_distribution
  • new_coverage
  • new_duplicated_lines_density
  • new_lines
  • new_maintainability_rating
  • new_reliability_rating
  • new_security_rating
  • reliability_rating
  • security_rating
  • sqale_rating

To filter on a rating, provide the corresponding metric key (ex: reliability_rating for reliability rating).
The possible values are:
  • '1' for rating A
  • '2' for rating B
  • '3' for rating C
  • '4' for rating D
  • '5' for rating E
To filter on a Quality Gate status use the metric key 'alert_status'. Only the '=' operator can be used.
The possible values are:
  • 'OK' for Passed
  • 'WARN' for Warning
  • 'ERROR' for Failed
To filter on language keys use the language key:
  • to filter on a single language you can use 'language = java'
  • to filter on several languages you must use 'language IN (java, js)'
Use the WS api/languages/list to find the key of a language.
To filter on tags use the 'tag' keyword:
  • to filter on one tag you can use tag = finance
  • to filter on several tags you must use tag in (offshore, java)
+ * + */ + public SearchProjectsRequest setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getFilter() { + return filter; + } + + /** + * the organization to search projects in + * + * This is part of the internal API. + */ + public SearchProjectsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Sort projects by numeric metric key, quality gate status (using 'alert_status'), last analysis date (using 'analysisDate'), or by project name. + * + * Possible values: + *
    + *
  • "alert_status"
  • + *
  • "analysisDate"
  • + *
  • "coverage"
  • + *
  • "duplicated_lines_density"
  • + *
  • "lines"
  • + *
  • "name"
  • + *
  • "ncloc"
  • + *
  • "ncloc_language_distribution"
  • + *
  • "new_coverage"
  • + *
  • "new_duplicated_lines_density"
  • + *
  • "new_lines"
  • + *
  • "new_maintainability_rating"
  • + *
  • "new_reliability_rating"
  • + *
  • "new_security_rating"
  • + *
  • "reliability_rating"
  • + *
  • "security_rating"
  • + *
  • "sqale_rating"
  • + *
+ */ + public SearchProjectsRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java new file mode 100644 index 00000000000..a9da503da34 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java @@ -0,0 +1,135 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for components + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private List qualifiers; + + /** + * Language key. If provided, only components for the given language are returned. + * + * Example value: "" + */ + public SearchRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
  • component names that contain the supplied string
  • component keys that are exactly the same as the supplied string
+ * + * Example value: "sonar" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:
  • BRC - Sub-projects
  • DIR - Directories
  • FIL - Files
  • TRK - Projects
  • UTS - Test Files
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "BRC"
  • + *
  • "DIR"
  • + *
  • "FIL"
  • + *
  • "TRK"
  • + *
  • "UTS"
  • + *
+ */ + public SearchRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java new file mode 100644 index 00000000000..6c7a5b8e2ab --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Returns a component (file, directory, project, view…) and its ancestors. The ancestors are ordered from the parent to the root project. The 'componentId' or 'component' parameter must be provided.
Requires the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String branch; + private String component; + private String componentId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ShowRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ShowRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public ShowRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java new file mode 100644 index 00000000000..ffb87596a8f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java @@ -0,0 +1,90 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.

Each result contains:

  • the organization key
  • the component key
  • the component's name (unescaped)
  • optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SuggestionsRequest { + + private String more; + private List recentlyBrowsed; + private String s; + + /** + * Category, for which to display the next 20 results (skipping the first 6 results) + * + * Possible values: + *
    + *
  • "VW"
  • + *
  • "SVW"
  • + *
  • "APP"
  • + *
  • "TRK"
  • + *
  • "BRC"
  • + *
  • "FIL"
  • + *
  • "UTS"
  • + *
+ */ + public SuggestionsRequest setMore(String more) { + this.more = more; + return this; + } + + public String getMore() { + return more; + } + + /** + * Comma separated list of component keys, that have recently been browsed by the user. Only the first 50 items will be used. Order is not taken into account. + * + * Example value: "org.sonarsource:sonarqube,some.other:project" + */ + public SuggestionsRequest setRecentlyBrowsed(List recentlyBrowsed) { + this.recentlyBrowsed = recentlyBrowsed; + return this; + } + + public List getRecentlyBrowsed() { + return recentlyBrowsed; + } + + /** + * Search query: can contain several search tokens separated by spaces. + * + * Example value: "sonar" + */ + public SuggestionsRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java new file mode 100644 index 00000000000..300dd6bb0ce --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java @@ -0,0 +1,213 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Navigate through components based on the chosen strategy. The componentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the specified project.
When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TreeRequest { + + private String asc; + private String branch; + private String component; + private String componentId; + private String p; + private String ps; + private String q; + private List qualifiers; + private List s; + private String strategy; + + /** + * Ascending sort + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public TreeRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public TreeRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Base component key. The search is based on this component. + * + * Example value: "my_project" + */ + public TreeRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Base component id. The search is based on this component. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.4 + */ + @Deprecated + public TreeRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TreeRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public TreeRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
  • component names that contain the supplied string
  • component keys that are exactly the same as the supplied string
+ * + * Example value: "FILE_NAM" + */ + public TreeRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:
  • BRC - Sub-projects
  • DIR - Directories
  • FIL - Files
  • TRK - Projects
  • UTS - Test Files
+ * + * Possible values: + *
    + *
  • "BRC"
  • + *
  • "DIR"
  • + *
  • "FIL"
  • + *
  • "TRK"
  • + *
  • "UTS"
  • + *
+ */ + public TreeRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + /** + * Comma-separated list of sort fields + * + * Example value: "name, path" + * Possible values: + *
    + *
  • "name"
  • + *
  • "path"
  • + *
  • "qualifier"
  • + *
+ */ + public TreeRequest setS(List s) { + this.s = s; + return this; + } + + public List getS() { + return s; + } + + /** + * Strategy to search for base component descendants:
  • children: return the children components of the base component. Grandchildren components are not returned
  • all: return all the descendants components of the base component. Grandchildren are returned.
  • leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.
+ * + * Possible values: + *
    + *
  • "all"
  • + *
  • "children"
  • + *
  • "leaves"
  • + *
+ */ + public TreeRequest setStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + public String getStrategy() { + return strategy; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/package-info.java new file mode 100644 index 00000000000..f9d52cab322 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/components/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.components; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java new file mode 100644 index 00000000000..b77bd2903ab --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java @@ -0,0 +1,127 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a custom measure.
The project id or the project key must be provided (only project and module custom measures can be created). The metric id or the metric key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String description; + private String metricId; + private String metricKey; + private String projectId; + private String projectKey; + private String value; + + /** + * Description + * + * Example value: "Team size growing." + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Metric id + * + * Example value: "16" + */ + public CreateRequest setMetricId(String metricId) { + this.metricId = metricId; + return this; + } + + public String getMetricId() { + return metricId; + } + + /** + * Metric key + * + * Example value: "ncloc" + */ + public CreateRequest setMetricKey(String metricKey) { + this.metricKey = metricKey; + return this; + } + + public String getMetricKey() { + return metricKey; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public CreateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public CreateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Measure value. Value type depends on metric type:
  • INT - type: integer
  • FLOAT - type: double
  • PERCENT - type: double
  • BOOL - the possible values are true or false
  • STRING - type: string
  • MILLISEC - type: integer
  • DATA - type: string
  • LEVEL - the possible values are OK, WARN, ERROR
  • DISTRIB - type: string
  • RATING - type: double
  • WORK_DUR - long representing the number of minutes
+ * + * This is a mandatory parameter. + * Example value: "47" + */ + public CreateRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java new file mode 100644 index 00000000000..0838f1b37c9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java @@ -0,0 +1,132 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage custom measures for a project. See also api/metrics. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CustomMeasuresService extends BaseService { + + public CustomMeasuresService(WsConnector wsConnector) { + super(wsConnector, "api/custom_measures"); + } + + /** + * Create a custom measure.
The project id or the project key must be provided (only project and module custom measures can be created). The metric id or the metric key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("metricId", request.getMetricId()) + .setParam("metricKey", request.getMetricKey()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("value", request.getValue()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a custom measure.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all custom metrics for which no custom measure already exists on a given project.
The project id or project key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String metrics(MetricsRequest request) { + return call( + new GetRequest(path("metrics")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List custom measures. The project id or project key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a custom measure. Value and/or description must be provided
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("value", request.getValue()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java new file mode 100644 index 00000000000..922e4c374e6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a custom measure.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String id; + + /** + * Id + * + * This is a mandatory parameter. + * Example value: "24" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java new file mode 100644 index 00000000000..7915309dce5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List all custom metrics for which no custom measure already exists on a given project.
The project id or project key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class MetricsRequest { + + private String projectId; + private String projectKey; + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public MetricsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public MetricsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java new file mode 100644 index 00000000000..55036e60b43 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java @@ -0,0 +1,122 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List custom measures. The project id or project key must be provided.
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List f; + private String p; + private String projectId; + private String projectKey; + private String ps; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
    + *
  • "projectId"
  • + *
  • "projectKey"
  • + *
  • "value"
  • + *
  • "description"
  • + *
  • "metric"
  • + *
  • "createdAt"
  • + *
  • "updatedAt"
  • + *
  • "user"
  • + *
  • "pending"
  • + *
+ */ + public SearchRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public SearchRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java new file mode 100644 index 00000000000..076058b3ddc --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java @@ -0,0 +1,80 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a custom measure. Value and/or description must be provided
Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String id; + private String value; + + /** + * Example value: "Team size growing." + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * id + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Measure value. Value type depends on metric type:
  • INT - type: integer
  • FLOAT - type: double
  • PERCENT - type: double
  • BOOL - the possible values are true or false
  • STRING - type: string
  • MILLISEC - type: integer
  • DATA - type: string
  • LEVEL - the possible values are OK, WARN, ERROR
  • DISTRIB - type: string
  • RATING - type: double
  • WORK_DUR - long representing the number of minutes
+ * + * Example value: "true" + */ + public UpdateRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java new file mode 100644 index 00000000000..54c68868c23 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.custommeasures; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java new file mode 100644 index 00000000000..dcb0fffbd44 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java @@ -0,0 +1,58 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.duplications; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Duplications.ShowResponse; + +/** + * Get duplication information for a project. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DuplicationsService extends BaseService { + + public DuplicationsService(WsConnector wsConnector) { + super(wsConnector, "api/duplications"); + } + + /** + * Get duplications. Require Browse permission on file's project + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setParam("uuid", request.getUuid()), + ShowResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java new file mode 100644 index 00000000000..aa9cde5691f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.duplications; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get duplications. Require Browse permission on file's project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String branch; + private String key; + private String uuid; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ShowRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * File key + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * File ID. If provided, 'key' must not be provided. + * + * Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2" + * @deprecated since 6.5 + */ + @Deprecated + public ShowRequest setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getUuid() { + return uuid; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/package-info.java new file mode 100644 index 00000000000..cbd34e1eec1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/duplications/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.duplications; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java new file mode 100644 index 00000000000..ba79abb48e4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Apply changes to SonarQube to match the specified license. Clear error message of previous automatic install of an edition, if there is any. Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ApplyLicenseRequest { + + private String license; + + /** + * the license + * + * This is a mandatory parameter. + */ + public ApplyLicenseRequest setLicense(String license) { + this.license = license; + return this; + } + + public String getLicense() { + return license; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java new file mode 100644 index 00000000000..1ee4ae088e2 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java @@ -0,0 +1,132 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Editions.FormDataResponse; +import org.sonarqube.ws.Editions.PreviewResponse; +import org.sonarqube.ws.Editions.StatusResponse; + +/** + * Manage SonarSource commercial editions. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class EditionsService extends BaseService { + + public EditionsService(WsConnector wsConnector) { + super(wsConnector, "api/editions"); + } + + /** + * Apply changes to SonarQube to match the specified license. Clear error message of previous automatic install of an edition, if there is any. Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public String applyLicense(ApplyLicenseRequest request) { + return call( + new PostRequest(path("apply_license")) + .setParam("license", request.getLicense()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Clear error message of last install of an edition (if any). Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public void clearErrorMessage() { + call( + new PostRequest(path("clear_error_message")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Provide data to prefill license request forms: the server ID and the total number of lines of code. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public FormDataResponse formData() { + return call( + new GetRequest(path("form_data")), + FormDataResponse.parser()); + } + + /** + * Preview the changes to SonarQube to match the specified license. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public PreviewResponse preview(PreviewRequest request) { + return call( + new PostRequest(path("preview")) + .setParam("license", request.getLicense()), + PreviewResponse.parser()); + } + + /** + * Provide status of SonarSource commercial edition of the current SonarQube. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public StatusResponse status() { + return call( + new GetRequest(path("status")), + StatusResponse.parser()); + } + + /** + * Uninstall the currently installed edition. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ + public void uninstall() { + call( + new PostRequest(path("uninstall")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java new file mode 100644 index 00000000000..00f909c4871 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Preview the changes to SonarQube to match the specified license. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class PreviewRequest { + + private String license; + + /** + * the license + * + * This is a mandatory parameter. + */ + public PreviewRequest setLicense(String license) { + this.license = license; + return this; + } + + public String getLicense() { + return license; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/package-info.java new file mode 100644 index 00000000000..e600294d249 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/editions/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.editions; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java new file mode 100644 index 00000000000..cbf56d8bf35 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java @@ -0,0 +1,58 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.emails; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage emails + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class EmailsService extends BaseService { + + public EmailsService(WsConnector wsConnector) { + super(wsConnector, "api/emails"); + } + + /** + * Test email configuration by sending an email
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public void send(SendRequest request) { + call( + new PostRequest(path("send")) + .setParam("message", request.getMessage()) + .setParam("subject", request.getSubject()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java new file mode 100644 index 00000000000..8880e49aca4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.emails; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Test email configuration by sending an email
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SendRequest { + + private String message; + private String subject; + private String to; + + /** + * Content of the email + * + * This is a mandatory parameter. + */ + public SendRequest setMessage(String message) { + this.message = message; + return this; + } + + public String getMessage() { + return message; + } + + /** + * Subject of the email + * + * Example value: "Test Message from SonarQube" + */ + public SendRequest setSubject(String subject) { + this.subject = subject; + return this; + } + + public String getSubject() { + return subject; + } + + /** + * Email address + * + * This is a mandatory parameter. + * Example value: "john@doo.com" + */ + public SendRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/package-info.java new file mode 100644 index 00000000000..2219eedc11c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/emails/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.emails; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java new file mode 100644 index 00000000000..5bf113524f4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a component (project, directory, file etc.) as favorite for the authenticated user.
Requires authentication and the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddRequest { + + private String component; + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public AddRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java new file mode 100644 index 00000000000..2aaf636af4e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java @@ -0,0 +1,89 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Favorites.SearchResponse; + +/** + * Manage user favorites + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class FavoritesService extends BaseService { + + public FavoritesService(WsConnector wsConnector) { + super(wsConnector, "api/favorites"); + } + + /** + * Add a component (project, directory, file etc.) as favorite for the authenticated user.
Requires authentication and the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void add(AddRequest request) { + call( + new PostRequest(path("add")) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a component (project, directory, file etc.) as favorite for the authenticated user.
Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void remove(RemoveRequest request) { + call( + new PostRequest(path("remove")) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for the authenticated user favorites.
Requires authentication. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java new file mode 100644 index 00000000000..2d344621826 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a component (project, directory, file etc.) as favorite for the authenticated user.
Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveRequest { + + private String component; + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public RemoveRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java new file mode 100644 index 00000000000..77eaab54230 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for the authenticated user favorites.
Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String p; + private String ps; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/package-info.java new file mode 100644 index 00000000000..3a3d70569a0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favorites/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.favorites; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java new file mode 100644 index 00000000000..67a4b2754dd --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favourites; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/favorites instead + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class FavouritesService extends BaseService { + + public FavouritesService(WsConnector wsConnector) { + super(wsConnector, "api/favourites"); + } + + /** + * The web service is removed and you're invited to use api/favorites instead + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/package-info.java new file mode 100644 index 00000000000..49cec47934d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/favourites/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.favourites; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java new file mode 100644 index 00000000000..4d0d3976c9d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddCommentRequest { + + private String issue; + private String text; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddCommentRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Comment text + * + * This is a mandatory parameter. + * Example value: "Won't fix because it doesn't apply to the context" + */ + public AddCommentRequest setText(String text) { + this.text = text; + return this; + } + + public String getText() { + return text; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java new file mode 100644 index 00000000000..1ae5e92928a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java @@ -0,0 +1,90 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Assign/Unassign an issue. Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AssignRequest { + + private String assignee; + private String issue; + private String me; + + /** + * Login of the assignee. When not set, it will unassign the issue. Use '_me' to assign to current user + * + * Example value: "admin" + */ + public AssignRequest setAssignee(String assignee) { + this.assignee = assignee; + return this; + } + + public String getAssignee() { + return assignee; + } + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AssignRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * (deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ * @deprecated since 5.2 + */ + @Deprecated + public AssignRequest setMe(String me) { + this.me = me; + return this; + } + + public String getMe() { + return me; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java new file mode 100644 index 00000000000..8dc8cf39078 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search SCM accounts which match a given query + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AuthorsRequest { + + private String ps; + private String q; + + /** + * The size of the list to return + * + * Example value: "25" + */ + public AuthorsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * A pattern to match SCM accounts against + * + * Example value: "luke" + */ + public AuthorsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java new file mode 100644 index 00000000000..3de99852d96 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java @@ -0,0 +1,216 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk change on issues.
Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BulkChangeRequest { + + private String addTags; + private String assign; + private String comment; + private String doTransition; + private List issues; + private String plan; + private String removeTags; + private String sendNotifications; + private String setSeverity; + private String setType; + + /** + * Add tags + * + * Example value: "security,java8" + */ + public BulkChangeRequest setAddTags(String addTags) { + this.addTags = addTags; + return this; + } + + public String getAddTags() { + return addTags; + } + + /** + * To assign the list of issues to a specific user (login), or un-assign all the issues + * + * Example value: "john.smith" + */ + public BulkChangeRequest setAssign(String assign) { + this.assign = assign; + return this; + } + + public String getAssign() { + return assign; + } + + /** + * To add a comment to a list of issues + * + * Example value: "Here is my comment" + */ + public BulkChangeRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } + + /** + * Transition + * + * Example value: "reopen" + * Possible values: + *
    + *
  • "confirm"
  • + *
  • "unconfirm"
  • + *
  • "reopen"
  • + *
  • "resolve"
  • + *
  • "falsepositive"
  • + *
  • "wontfix"
  • + *
  • "close"
  • + *
+ */ + public BulkChangeRequest setDoTransition(String doTransition) { + this.doTransition = doTransition; + return this; + } + + public String getDoTransition() { + return doTransition; + } + + /** + * Comma-separated list of issue keys + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + */ + public BulkChangeRequest setIssues(List issues) { + this.issues = issues; + return this; + } + + public List getIssues() { + return issues; + } + + /** + * In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan + * + * @deprecated since 5.5 + */ + @Deprecated + public BulkChangeRequest setPlan(String plan) { + this.plan = plan; + return this; + } + + public String getPlan() { + return plan; + } + + /** + * Remove tags + * + * Example value: "security,java8" + */ + public BulkChangeRequest setRemoveTags(String removeTags) { + this.removeTags = removeTags; + return this; + } + + public String getRemoveTags() { + return removeTags; + } + + /** + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public BulkChangeRequest setSendNotifications(String sendNotifications) { + this.sendNotifications = sendNotifications; + return this; + } + + public String getSendNotifications() { + return sendNotifications; + } + + /** + * To change the severity of the list of issues + * + * Example value: "BLOCKER" + * Possible values: + *
    + *
  • "INFO"
  • + *
  • "MINOR"
  • + *
  • "MAJOR"
  • + *
  • "CRITICAL"
  • + *
  • "BLOCKER"
  • + *
+ */ + public BulkChangeRequest setSetSeverity(String setSeverity) { + this.setSeverity = setSeverity; + return this; + } + + public String getSetSeverity() { + return setSeverity; + } + + /** + * To change the type of the list of issues + * + * Example value: "BUG" + * Possible values: + *
    + *
  • "CODE_SMELL"
  • + *
  • "BUG"
  • + *
  • "VULNERABILITY"
  • + *
+ */ + public BulkChangeRequest setSetType(String setType) { + this.setType = setType; + return this; + } + + public String getSetType() { + return setType; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java new file mode 100644 index 00000000000..530bbb7cce9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Display changelog of an issue.
Requires the 'Browse' permission on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ChangelogRequest { + + private String issue; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ChangelogRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java new file mode 100644 index 00000000000..64e3616af8b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List tags for the issues under a given component (including issues on the descendants of the component) + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentTagsRequest { + + private String componentUuid; + private String createdAfter; + private String ps; + + /** + * A component UUID + * + * This is a mandatory parameter. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public ComponentTagsRequest setComponentUuid(String componentUuid) { + this.componentUuid = componentUuid; + return this; + } + + public String getComponentUuid() { + return componentUuid; + } + + /** + * To retrieve tags on issues created after the given date (inclusive).
Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ComponentTagsRequest setCreatedAfter(String createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public String getCreatedAfter() { + return createdAfter; + } + + /** + * The maximum size of the list to return + * + * Example value: "25" + */ + public ComponentTagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java new file mode 100644 index 00000000000..a598ccded98 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteCommentRequest { + + private String comment; + + /** + * Comment key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeleteCommentRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java new file mode 100644 index 00000000000..8b3c0e92711 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java @@ -0,0 +1,77 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Do workflow transition on an issue. Requires authentication and Browse permission on project.
The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DoTransitionRequest { + + private String issue; + private String transition; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DoTransitionRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Transition + * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "confirm"
  • + *
  • "unconfirm"
  • + *
  • "reopen"
  • + *
  • "resolve"
  • + *
  • "falsepositive"
  • + *
  • "wontfix"
  • + *
  • "close"
  • + *
+ */ + public DoTransitionRequest setTransition(String transition) { + this.transition = transition; + return this; + } + + public String getTransition() { + return transition; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java new file mode 100644 index 00000000000..be7bdea9ead --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Edit a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class EditCommentRequest { + + private String comment; + private String text; + + /** + * Comment key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public EditCommentRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } + + /** + * Comment text + * + * This is a mandatory parameter. + * Example value: "Won't fix because it doesn't apply to the context" + */ + public EditCommentRequest setText(String text) { + this.text = text; + return this; + } + + public String getText() { + return text; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java new file mode 100644 index 00000000000..a8d72bedc2c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java @@ -0,0 +1,322 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Issues.BulkChangeWsResponse; +import org.sonarqube.ws.Issues.ChangelogWsResponse; +import org.sonarqube.ws.Issues.SearchWsResponse; + +/** + * Read and update issues. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IssuesService extends BaseService { + + public IssuesService(WsConnector wsConnector) { + super(wsConnector, "api/issues"); + } + + /** + * Add a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String addComment(AddCommentRequest request) { + return call( + new PostRequest(path("add_comment")) + .setParam("issue", request.getIssue()) + .setParam("text", request.getText()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Assign/Unassign an issue. Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String assign(AssignRequest request) { + return call( + new PostRequest(path("assign")) + .setParam("assignee", request.getAssignee()) + .setParam("issue", request.getIssue()) + .setParam("me", request.getMe()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search SCM accounts which match a given query + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String authors(AuthorsRequest request) { + return call( + new GetRequest(path("authors")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk change on issues.
Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ + public BulkChangeWsResponse bulkChange(BulkChangeRequest request) { + return call( + new PostRequest(path("bulk_change")) + .setParam("add_tags", request.getAddTags()) + .setParam("assign", request.getAssign()) + .setParam("comment", request.getComment()) + .setParam("do_transition", request.getDoTransition()) + .setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(","))) + .setParam("plan", request.getPlan()) + .setParam("remove_tags", request.getRemoveTags()) + .setParam("sendNotifications", request.getSendNotifications()) + .setParam("set_severity", request.getSetSeverity()) + .setParam("set_type", request.getSetType()), + BulkChangeWsResponse.parser()); + } + + /** + * Display changelog of an issue.
Requires the 'Browse' permission on the project of the specified issue. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.1 + */ + public ChangelogWsResponse changelog(ChangelogRequest request) { + return call( + new GetRequest(path("changelog")) + .setParam("issue", request.getIssue()), + ChangelogWsResponse.parser()); + } + + /** + * List tags for the issues under a given component (including issues on the descendants of the component) + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String componentTags(ComponentTagsRequest request) { + return call( + new GetRequest(path("component_tags")) + .setParam("componentUuid", request.getComponentUuid()) + .setParam("createdAfter", request.getCreatedAfter()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String deleteComment(DeleteCommentRequest request) { + return call( + new PostRequest(path("delete_comment")) + .setParam("comment", request.getComment()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Do workflow transition on an issue. Requires authentication and Browse permission on project.
The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String doTransition(DoTransitionRequest request) { + return call( + new PostRequest(path("do_transition")) + .setParam("issue", request.getIssue()) + .setParam("transition", request.getTransition()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Edit a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String editComment(EditCommentRequest request) { + return call( + new PostRequest(path("edit_comment")) + .setParam("comment", request.getComment()) + .setParam("text", request.getText()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for issues.
At most one of the following parameters can be provided at the same time: componentKeys, componentUuids, components, componentRootUuids, componentRoots.
Requires the 'Browse' permission on the specified project(s). + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("assigned", request.getAssigned()) + .setParam("assignees", request.getAssignees() == null ? null : request.getAssignees().stream().collect(Collectors.joining(","))) + .setParam("authors", request.getAuthors() == null ? null : request.getAuthors().stream().collect(Collectors.joining(","))) + .setParam("branch", request.getBranch()) + .setParam("componentKeys", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(","))) + .setParam("componentRootUuids", request.getComponentRootUuids()) + .setParam("componentRoots", request.getComponentRoots()) + .setParam("componentUuids", request.getComponentUuids() == null ? null : request.getComponentUuids().stream().collect(Collectors.joining(","))) + .setParam("components", request.getComponents()) + .setParam("createdAfter", request.getCreatedAfter()) + .setParam("createdAt", request.getCreatedAt()) + .setParam("createdBefore", request.getCreatedBefore()) + .setParam("createdInLast", request.getCreatedInLast()) + .setParam("directories", request.getDirectories() == null ? null : request.getDirectories().stream().collect(Collectors.joining(","))) + .setParam("facetMode", request.getFacetMode()) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("fileUuids", request.getFileUuids() == null ? null : request.getFileUuids().stream().collect(Collectors.joining(","))) + .setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(","))) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("moduleUuids", request.getModuleUuids() == null ? null : request.getModuleUuids().stream().collect(Collectors.joining(","))) + .setParam("onComponentOnly", request.getOnComponentOnly()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("projectUuids", request.getProjectUuids() == null ? null : request.getProjectUuids().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("ps", request.getPs()) + .setParam("resolutions", request.getResolutions() == null ? null : request.getResolutions().stream().collect(Collectors.joining(","))) + .setParam("resolved", request.getResolved()) + .setParam("rules", request.getRules() == null ? null : request.getRules().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("sinceLeakPeriod", request.getSinceLeakPeriod()) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Change severity.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public String setSeverity(SetSeverityRequest request) { + return call( + new PostRequest(path("set_severity")) + .setParam("issue", request.getIssue()) + .setParam("severity", request.getSeverity()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Set tags on an issue.
Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String setTags(SetTagsRequest request) { + return call( + new PostRequest(path("set_tags")) + .setParam("issue", request.getIssue()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Change type of issue, for instance from 'code smell' to 'bug'.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ + public String setType(SetTypeRequest request) { + return call( + new PostRequest(path("set_type")) + .setParam("issue", request.getIssue()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List tags matching a given query + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String tags(TagsRequest request) { + return call( + new GetRequest(path("tags")) + .setParam("organization", request.getOrganization()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java new file mode 100644 index 00000000000..d7955656b04 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java @@ -0,0 +1,705 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for issues.
At most one of the following parameters can be provided at the same time: componentKeys, componentUuids, components, componentRootUuids, componentRoots.
Requires the 'Browse' permission on the specified project(s). + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List additionalFields; + private String asc; + private String assigned; + private List assignees; + private List authors; + private String branch; + private List componentKeys; + private String componentRootUuids; + private String componentRoots; + private List componentUuids; + private String components; + private String createdAfter; + private String createdAt; + private String createdBefore; + private String createdInLast; + private List directories; + private String facetMode; + private List facets; + private List fileUuids; + private List issues; + private List languages; + private List moduleUuids; + private String onComponentOnly; + private String organization; + private String p; + private List projectUuids; + private List projects; + private String ps; + private List resolutions; + private String resolved; + private List rules; + private String s; + private List severities; + private String sinceLeakPeriod; + private List statuses; + private List tags; + private List types; + + /** + * Comma-separated list of the optional fields to be returned in response. Action plans are dropped in 5.5, it is not returned in the response. + * + * Possible values: + *
    + *
  • "_all"
  • + *
  • "comments"
  • + *
  • "languages"
  • + *
  • "actionPlans"
  • + *
  • "rules"
  • + *
  • "transitions"
  • + *
  • "actions"
  • + *
  • "users"
  • + *
+ */ + public SearchRequest setAdditionalFields(List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List getAdditionalFields() { + return additionalFields; + } + + /** + * Ascending sort + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * To retrieve assigned or unassigned issues + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchRequest setAssigned(String assigned) { + this.assigned = assigned; + return this; + } + + public String getAssigned() { + return assigned; + } + + /** + * Comma-separated list of assignee logins. The value '__me__' can be used as a placeholder for user who performs the request + * + * Example value: "admin,usera,__me__" + */ + public SearchRequest setAssignees(List assignees) { + this.assignees = assignees; + return this; + } + + public List getAssignees() { + return assignees; + } + + /** + * Comma-separated list of SCM accounts + * + * Example value: "torvalds@linux-foundation.org" + */ + public SearchRequest setAuthors(List authors) { + this.authors = authors; + return this; + } + + public List getAuthors() { + return authors; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Comma-separated list of component keys. Retrieve issues associated to a specific list of components (and all its descendants). A component can be a portfolio, project, module, directory or file. + * + * Example value: "my_project" + */ + public SearchRequest setComponentKeys(List componentKeys) { + this.componentKeys = componentKeys; + return this; + } + + public List getComponentKeys() { + return componentKeys; + } + + /** + * If used, will have the same meaning as componentUuids AND onComponentOnly=false. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponentRootUuids(String componentRootUuids) { + this.componentRootUuids = componentRootUuids; + return this; + } + + public String getComponentRootUuids() { + return componentRootUuids; + } + + /** + * If used, will have the same meaning as componentKeys AND onComponentOnly=false. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponentRoots(String componentRoots) { + this.componentRoots = componentRoots; + return this; + } + + public String getComponentRoots() { + return componentRoots; + } + + /** + * To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. A component can be a project, module, directory or file. + * + * Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2" + * @deprecated since 6.5 + */ + @Deprecated + public SearchRequest setComponentUuids(List componentUuids) { + this.componentUuids = componentUuids; + return this; + } + + public List getComponentUuids() { + return componentUuids; + } + + /** + * If used, will have the same meaning as componentKeys AND onComponentOnly=true. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponents(String components) { + this.components = components; + return this; + } + + public String getComponents() { + return components; + } + + /** + * To retrieve issues created after the given date (inclusive).
Either a date (server timezone) or datetime can be provided.
If this parameter is set, createdSince must not be set + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedAfter(String createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public String getCreatedAfter() { + return createdAfter; + } + + /** + * Datetime to retrieve issues created during a specific analysis + * + * Example value: "2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + public String getCreatedAt() { + return createdAt; + } + + /** + * To retrieve issues created before the given date (inclusive).
Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedBefore(String createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public String getCreatedBefore() { + return createdBefore; + } + + /** + * To retrieve issues created during a time span before the current time (exclusive). Accepted units are 'y' for year, 'm' for month, 'w' for week and 'd' for day. If this parameter is set, createdAfter must not be set + * + * Example value: "1m2w (1 month 2 weeks)" + */ + public SearchRequest setCreatedInLast(String createdInLast) { + this.createdInLast = createdInLast; + return this; + } + + public String getCreatedInLast() { + return createdInLast; + } + + /** + * To retrieve issues associated to a specific list of directories (comma-separated list of directory paths). This parameter is only meaningful when a module is selected. This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "src/main/java/org/sonar/server/" + */ + public SearchRequest setDirectories(List directories) { + this.directories = directories; + return this; + } + + public List getDirectories() { + return directories; + } + + /** + * Choose the returned value for facet items, either count of issues or sum of debt.
Since 5.5, 'debt' mode is deprecated and replaced by 'effort' + * + * Possible values: + *
    + *
  • "count"
  • + *
  • "effort"
  • + *
  • "debt"
  • + *
+ */ + public SearchRequest setFacetMode(String facetMode) { + this.facetMode = facetMode; + return this; + } + + public String getFacetMode() { + return facetMode; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default.
Since 5.5, facet 'actionPlans' is deprecated.
Since 5.5, facet 'reporters' is deprecated. + * + * Possible values: + *
    + *
  • "severities"
  • + *
  • "statuses"
  • + *
  • "resolutions"
  • + *
  • "actionPlans"
  • + *
  • "projectUuids"
  • + *
  • "rules"
  • + *
  • "assignees"
  • + *
  • "assigned_to_me"
  • + *
  • "reporters"
  • + *
  • "authors"
  • + *
  • "moduleUuids"
  • + *
  • "fileUuids"
  • + *
  • "directories"
  • + *
  • "languages"
  • + *
  • "tags"
  • + *
  • "types"
  • + *
  • "createdAt"
  • + *
+ */ + public SearchRequest setFacets(List facets) { + this.facets = facets; + return this; + } + + public List getFacets() { + return facets; + } + + /** + * To retrieve issues associated to a specific list of files (comma-separated list of file IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "bdd82933-3070-4903-9188-7d8749e8bb92" + */ + public SearchRequest setFileUuids(List fileUuids) { + this.fileUuids = fileUuids; + return this; + } + + public List getFileUuids() { + return fileUuids; + } + + /** + * Comma-separated list of issue keys + * + * Example value: "5bccd6e8-f525-43a2-8d76-fcb13dde79ef" + */ + public SearchRequest setIssues(List issues) { + this.issues = issues; + return this; + } + + public List getIssues() { + return issues; + } + + /** + * Comma-separated list of languages. Available since 4.4 + * + * Example value: "java,js" + */ + public SearchRequest setLanguages(List languages) { + this.languages = languages; + return this; + } + + public List getLanguages() { + return languages; + } + + /** + * To retrieve issues associated to a specific list of modules (comma-separated list of module IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public SearchRequest setModuleUuids(List moduleUuids) { + this.moduleUuids = moduleUuids; + return this; + } + + public List getModuleUuids() { + return moduleUuids; + } + + /** + * Return only issues at a component's level, not on its descendants (modules, directories, files, etc). This parameter is only considered when componentKeys or componentUuids is set. Using the deprecated componentRoots or componentRootUuids parameters will set this parameter to false. Using the deprecated components parameter will set this parameter to true. + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchRequest setOnComponentOnly(String onComponentOnly) { + this.onComponentOnly = onComponentOnly; + return this; + } + + public String getOnComponentOnly() { + return onComponentOnly; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * To retrieve issues associated to a specific list of projects (comma-separated list of project IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. Portfolios are not supported. If this parameter is set, 'projects' must not be set. + * + * This is part of the internal API. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public SearchRequest setProjectUuids(List projectUuids) { + this.projectUuids = projectUuids; + return this; + } + + public List getProjectUuids() { + return projectUuids; + } + + /** + * To retrieve issues associated to a specific list of projects (comma-separated list of project keys). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. If this parameter is set, projectUuids must not be set. + * + * This is part of the internal API. + * Example value: "my_project" + */ + public SearchRequest setProjects(List projects) { + this.projects = projects; + return this; + } + + public List getProjects() { + return projects; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Comma-separated list of resolutions + * + * Example value: "FIXED,REMOVED" + * Possible values: + *
    + *
  • "FALSE-POSITIVE"
  • + *
  • "WONTFIX"
  • + *
  • "FIXED"
  • + *
  • "REMOVED"
  • + *
+ */ + public SearchRequest setResolutions(List resolutions) { + this.resolutions = resolutions; + return this; + } + + public List getResolutions() { + return resolutions; + } + + /** + * To match resolved or unresolved issues + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchRequest setResolved(String resolved) { + this.resolved = resolved; + return this; + } + + public String getResolved() { + return resolved; + } + + /** + * Comma-separated list of coding rule keys. Format is <repository>:<rule> + * + * Example value: "squid:AvoidCycles" + */ + public SearchRequest setRules(List rules) { + this.rules = rules; + return this; + } + + public List getRules() { + return rules; + } + + /** + * Sort field + * + * Possible values: + *
    + *
  • "CREATION_DATE"
  • + *
  • "UPDATE_DATE"
  • + *
  • "CLOSE_DATE"
  • + *
  • "ASSIGNEE"
  • + *
  • "SEVERITY"
  • + *
  • "STATUS"
  • + *
  • "FILE_LINE"
  • + *
+ */ + public SearchRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of severities + * + * Example value: "BLOCKER,CRITICAL" + * Possible values: + *
    + *
  • "INFO"
  • + *
  • "MINOR"
  • + *
  • "MAJOR"
  • + *
  • "CRITICAL"
  • + *
  • "BLOCKER"
  • + *
+ */ + public SearchRequest setSeverities(List severities) { + this.severities = severities; + return this; + } + + public List getSeverities() { + return severities; + } + + /** + * To retrieve issues created since the leak period.
If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided. + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public SearchRequest setSinceLeakPeriod(String sinceLeakPeriod) { + this.sinceLeakPeriod = sinceLeakPeriod; + return this; + } + + public String getSinceLeakPeriod() { + return sinceLeakPeriod; + } + + /** + * Comma-separated list of statuses + * + * Example value: "OPEN,REOPENED" + * Possible values: + *
    + *
  • "OPEN"
  • + *
  • "CONFIRMED"
  • + *
  • "REOPENED"
  • + *
  • "RESOLVED"
  • + *
  • "CLOSED"
  • + *
+ */ + public SearchRequest setStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + public List getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. + * + * Example value: "security,convention" + */ + public SearchRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } + + /** + * Comma-separated list of types. + * + * Example value: "CODE_SMELL,BUG" + * Possible values: + *
    + *
  • "CODE_SMELL"
  • + *
  • "BUG"
  • + *
  • "VULNERABILITY"
  • + *
+ */ + public SearchRequest setTypes(List types) { + this.types = types; + return this; + } + + public List getTypes() { + return types; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java new file mode 100644 index 00000000000..4553d2def0a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java @@ -0,0 +1,75 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Change severity.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetSeverityRequest { + + private String issue; + private String severity; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetSeverityRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * New severity + * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "INFO"
  • + *
  • "MINOR"
  • + *
  • "MAJOR"
  • + *
  • "CRITICAL"
  • + *
  • "BLOCKER"
  • + *
+ */ + public SetSeverityRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java new file mode 100644 index 00000000000..83b7f428ec9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set tags on an issue.
Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetTagsRequest { + + private String issue; + private List tags; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetTagsRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Comma-separated list of tags. All tags are removed if parameter is empty or not set. + * + * Example value: "security,cwe,misra-c" + */ + public SetTagsRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java new file mode 100644 index 00000000000..3150770ff19 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Change type of issue, for instance from 'code smell' to 'bug'.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetTypeRequest { + + private String issue; + private String type; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetTypeRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * New type + * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "CODE_SMELL"
  • + *
  • "BUG"
  • + *
  • "VULNERABILITY"
  • + *
+ */ + public SetTypeRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java new file mode 100644 index 00000000000..76e999b289f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List tags matching a given query + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TagsRequest { + + private String organization; + private String ps; + private String q; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TagsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "misra" + */ + public TagsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/package-info.java new file mode 100644 index 00000000000..54bcbbbe7c4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/issues/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.issues; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java new file mode 100644 index 00000000000..c03da919563 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.l10n; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get all localization messages for a given locale + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IndexRequest { + + private String locale; + private String ts; + + /** + * BCP47 language tag, used to override the browser Accept-Language header + * + * Example value: "fr-CH" + */ + public IndexRequest setLocale(String locale) { + this.locale = locale; + return this; + } + + public String getLocale() { + return locale; + } + + /** + * Date of the last cache update. + * + * Example value: "2014-06-04T09:31:42+0000" + */ + public IndexRequest setTs(String ts) { + this.ts = ts; + return this; + } + + public String getTs() { + return ts; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java new file mode 100644 index 00000000000..175d75761f5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.l10n; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage localization. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class L10nService extends BaseService { + + public L10nService(WsConnector wsConnector) { + super(wsConnector, "api/l10n"); + } + + /** + * Get all localization messages for a given locale + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("locale", request.getLocale()) + .setParam("ts", request.getTs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/package-info.java new file mode 100644 index 00000000000..ee4983df47a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/l10n/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.l10n; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java new file mode 100644 index 00000000000..4b137c8c726 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.languages; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get the list of programming languages supported in this instance. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class LanguagesService extends BaseService { + + public LanguagesService(WsConnector wsConnector) { + super(wsConnector, "api/languages"); + } + + /** + * List supported programming languages + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java new file mode 100644 index 00000000000..4c490cc303e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.languages; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List supported programming languages + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListRequest { + + private String ps; + private String q; + + /** + * The size of the list to return, 0 for all languages + * + * Example value: "25" + */ + public ListRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * A pattern to match language keys/names against + * + * Example value: "java" + */ + public ListRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/package-info.java new file mode 100644 index 00000000000..8dafd59b3ba --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/languages/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.languages; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java new file mode 100644 index 00000000000..0c008a32cf1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java @@ -0,0 +1,152 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return component with specified measures. The componentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the project of specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentRequest { + + private List additionalFields; + private String branch; + private String component; + private String componentId; + private String developerId; + private String developerKey; + private String metricKeys; + + /** + * Comma-separated list of additional fields that can be returned in the response. + * + * Example value: "periods,metrics" + * Possible values: + *
    + *
  • "metrics"
  • + *
  • "periods"
  • + *
+ */ + public ComponentRequest setAdditionalFields(List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List getAdditionalFields() { + return additionalFields; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentRequest setDeveloperId(String developerId) { + this.developerId = developerId; + return this; + } + + public String getDeveloperId() { + return developerId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentRequest setDeveloperKey(String developerKey) { + this.developerKey = developerKey; + return this; + } + + public String getDeveloperKey() { + return developerKey; + } + + /** + * Metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public ComponentRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java new file mode 100644 index 00000000000..32818d1633f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java @@ -0,0 +1,335 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Navigate through components based on the chosen strategy with specified measures. The baseComponentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the specified project.
When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentTreeRequest { + + private List additionalFields; + private String asc; + private String baseComponentId; + private String branch; + private String component; + private String developerId; + private String developerKey; + private String metricKeys; + private String metricPeriodSort; + private String metricSort; + private String metricSortFilter; + private String p; + private String ps; + private String q; + private List qualifiers; + private List s; + private String strategy; + + /** + * Comma-separated list of additional fields that can be returned in the response. + * + * Example value: "periods,metrics" + * Possible values: + *
    + *
  • "metrics"
  • + *
  • "periods"
  • + *
+ */ + public ComponentTreeRequest setAdditionalFields(List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List getAdditionalFields() { + return additionalFields; + } + + /** + * Ascending sort + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public ComponentTreeRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Base component id. The search is based on this component. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentTreeRequest setBaseComponentId(String baseComponentId) { + this.baseComponentId = baseComponentId; + return this; + } + + public String getBaseComponentId() { + return baseComponentId; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentTreeRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key. The search is based on this component. + * + * Example value: "my_project" + */ + public ComponentTreeRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentTreeRequest setDeveloperId(String developerId) { + this.developerId = developerId; + return this; + } + + public String getDeveloperId() { + return developerId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentTreeRequest setDeveloperKey(String developerKey) { + this.developerKey = developerKey; + return this; + } + + public String getDeveloperKey() { + return developerKey; + } + + /** + * Metric keys. Types DISTRIB, DATA are not allowed + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public ComponentTreeRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } + + /** + * Sort measures by leak period or not ?. The 's' parameter must contain the 'metricPeriod' value. + * + * Possible values: + *
    + *
  • "1"
  • + *
+ */ + public ComponentTreeRequest setMetricPeriodSort(String metricPeriodSort) { + this.metricPeriodSort = metricPeriodSort; + return this; + } + + public String getMetricPeriodSort() { + return metricPeriodSort; + } + + /** + * Metric key to sort by. The 's' parameter must contain the 'metric' or 'metricPeriod' value. It must be part of the 'metricKeys' parameter + * + * Example value: "ncloc" + */ + public ComponentTreeRequest setMetricSort(String metricSort) { + this.metricSort = metricSort; + return this; + } + + public String getMetricSort() { + return metricSort; + } + + /** + * Filter components. Sort must be on a metric. Possible values are:
  • all: return all components
  • withMeasuresOnly: filter out components that do not have a measure on the sorted metric
+ * + * Possible values: + *
    + *
  • "all"
  • + *
  • "withMeasuresOnly"
  • + *
+ */ + public ComponentTreeRequest setMetricSortFilter(String metricSortFilter) { + this.metricSortFilter = metricSortFilter; + return this; + } + + public String getMetricSortFilter() { + return metricSortFilter; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ComponentTreeRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ComponentTreeRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
  • component names that contain the supplied string
  • component keys that are exactly the same as the supplied string
+ * + * Example value: "FILE_NAM" + */ + public ComponentTreeRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:
  • BRC - Sub-projects
  • DIR - Directories
  • FIL - Files
  • TRK - Projects
  • UTS - Test Files
+ * + * Possible values: + *
    + *
  • "BRC"
  • + *
  • "DIR"
  • + *
  • "FIL"
  • + *
  • "TRK"
  • + *
  • "UTS"
  • + *
+ */ + public ComponentTreeRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + /** + * Comma-separated list of sort fields + * + * Example value: "name,path" + * Possible values: + *
    + *
  • "metric"
  • + *
  • "metricPeriod"
  • + *
  • "name"
  • + *
  • "path"
  • + *
  • "qualifier"
  • + *
+ */ + public ComponentTreeRequest setS(List s) { + this.s = s; + return this; + } + + public List getS() { + return s; + } + + /** + * Strategy to search for base component descendants:
  • children: return the children components of the base component. Grandchildren components are not returned
  • all: return all the descendants components of the base component. Grandchildren are returned.
  • leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.
+ * + * Possible values: + *
    + *
  • "all"
  • + *
  • "children"
  • + *
  • "leaves"
  • + *
+ */ + public ComponentTreeRequest setStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + public String getStrategy() { + return strategy; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java new file mode 100644 index 00000000000..bae8d11d5ac --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java @@ -0,0 +1,133 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Measures.ComponentWsResponse; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures.SearchWsResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse; + +/** + * Get components or children with specified measures. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class MeasuresService extends BaseService { + + public MeasuresService(WsConnector wsConnector) { + super(wsConnector, "api/measures"); + } + + /** + * Return component with specified measures. The componentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the project of specified component. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ + public ComponentWsResponse component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setParam("developerId", request.getDeveloperId()) + .setParam("developerKey", request.getDeveloperKey()) + .setParam("metricKeys", request.getMetricKeys()), + ComponentWsResponse.parser()); + } + + /** + * Navigate through components based on the chosen strategy with specified measures. The baseComponentId or the component parameter must be provided.
Requires the following permission: 'Browse' on the specified project.
When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.4 + */ + public ComponentTreeWsResponse componentTree(ComponentTreeRequest request) { + return call( + new GetRequest(path("component_tree")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("baseComponentId", request.getBaseComponentId()) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("developerId", request.getDeveloperId()) + .setParam("developerKey", request.getDeveloperKey()) + .setParam("metricKeys", request.getMetricKeys()) + .setParam("metricPeriodSort", request.getMetricPeriodSort()) + .setParam("metricSort", request.getMetricSort()) + .setParam("metricSortFilter", request.getMetricSortFilter()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS() == null ? null : request.getS().stream().collect(Collectors.joining(","))) + .setParam("strategy", request.getStrategy()), + ComponentTreeWsResponse.parser()); + } + + /** + * Search for project measures ordered by project names.
At most 100 projects can be provided.
Returns the projects with the 'Browse' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("metricKeys", request.getMetricKeys()) + .setParam("projectKeys", request.getProjectKeys() == null ? null : request.getProjectKeys().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Search measures history of a component.
Measures are ordered chronologically.
Pagination applies to the number of measures for each metric.
Requires the following permission: 'Browse' on the specified component + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public SearchHistoryResponse searchHistory(SearchHistoryRequest request) { + return call( + new GetRequest(path("search_history")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("from", request.getFrom()) + .setParam("metrics", request.getMetrics() == null ? null : request.getMetrics().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("to", request.getTo()), + SearchHistoryResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java new file mode 100644 index 00000000000..5b468e8a95a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java @@ -0,0 +1,144 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search measures history of a component.
Measures are ordered chronologically.
Pagination applies to the number of measures for each metric.
Requires the following permission: 'Browse' on the specified component + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchHistoryRequest { + + private String branch; + private String component; + private String from; + private List metrics; + private String p; + private String ps; + private String to; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchHistoryRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SearchHistoryRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Filter measures created after the given date (inclusive).
Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchHistoryRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Comma-separated list of metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,coverage,new_violations" + */ + public SearchHistoryRequest setMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + public List getMetrics() { + return metrics; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchHistoryRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 1000 + * + * Example value: "20" + */ + public SearchHistoryRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter measures created before the given date (inclusive).
Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchHistoryRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java new file mode 100644 index 00000000000..5d74b2da93f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for project measures ordered by project names.
At most 100 projects can be provided.
Returns the projects with the 'Browse' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String metricKeys; + private List projectKeys; + + /** + * Metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public SearchRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } + + /** + * Comma-separated list of project, view or sub-view keys + * + * This is a mandatory parameter. + * Example value: "my_project,another_project" + */ + public SearchRequest setProjectKeys(List projectKeys) { + this.projectKeys = projectKeys; + return this; + } + + public List getProjectKeys() { + return projectKeys; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/package-info.java new file mode 100644 index 00000000000..9f1f8db5423 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/measures/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.measures; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java new file mode 100644 index 00000000000..bdcb9aee616 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create custom metric.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String description; + private String domain; + private String key; + private String name; + private String type; + + /** + * Description + * + * Example value: "Size of the team" + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Domain + * + * Example value: "Tests" + */ + public CreateRequest setDomain(String domain) { + this.domain = domain; + return this; + } + + public String getDomain() { + return domain; + } + + /** + * Key + * + * This is a mandatory parameter. + * Example value: "team_size" + */ + public CreateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "Team Size" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Metric type key + * + * This is a mandatory parameter. + * Example value: "INT" + * Possible values: + *
    + *
  • "INT"
  • + *
  • "FLOAT"
  • + *
  • "PERCENT"
  • + *
  • "BOOL"
  • + *
  • "STRING"
  • + *
  • "MILLISEC"
  • + *
  • "DATA"
  • + *
  • "LEVEL"
  • + *
  • "DISTRIB"
  • + *
  • "RATING"
  • + *
  • "WORK_DUR"
  • + *
+ */ + public CreateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java new file mode 100644 index 00000000000..360f8e04ace --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete metrics and associated measures. Delete only custom metrics.
Ids or keys must be provided.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String ids; + private String keys; + + /** + * Metrics ids to delete. + * + * Example value: "5, 23, 42" + */ + public DeleteRequest setIds(String ids) { + this.ids = ids; + return this; + } + + public String getIds() { + return ids; + } + + /** + * Metrics keys to delete + * + * Example value: "team_size, business_value" + */ + public DeleteRequest setKeys(String keys) { + this.keys = keys; + return this; + } + + public String getKeys() { + return keys; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java new file mode 100644 index 00000000000..abbce2500db --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java @@ -0,0 +1,147 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information on automatic metrics, and manage custom metrics. See also api/custom_measures. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class MetricsService extends BaseService { + + public MetricsService(WsConnector wsConnector) { + super(wsConnector, "api/metrics"); + } + + /** + * Create custom metric.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("domain", request.getDomain()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete metrics and associated measures. Delete only custom metrics.
Ids or keys must be provided.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("ids", request.getIds()) + .setParam("keys", request.getKeys()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all custom metric domains. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String domains() { + return call( + new GetRequest(path("domains")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for metrics + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("isCustom", request.getIsCustom()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all available metric types. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String types() { + return call( + new GetRequest(path("types")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a custom metric.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("domain", request.getDomain()) + .setParam("id", request.getId()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java new file mode 100644 index 00000000000..9ef6d5ab8b6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java @@ -0,0 +1,106 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for metrics + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List f; + private String isCustom; + private String p; + private String ps; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
    + *
  • "name"
  • + *
  • "description"
  • + *
  • "domain"
  • + *
  • "direction"
  • + *
  • "qualitative"
  • + *
  • "hidden"
  • + *
  • "custom"
  • + *
  • "decimalScale"
  • + *
+ */ + public SearchRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * Choose custom metrics following 3 cases:
  • true: only custom metrics are returned
  • false: only non custom metrics are returned
  • not specified: all metrics are returned
+ * + * Example value: "true" + */ + public SearchRequest setIsCustom(String isCustom) { + this.isCustom = isCustom; + return this; + } + + public String getIsCustom() { + return isCustom; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java new file mode 100644 index 00000000000..e5326670829 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java @@ -0,0 +1,140 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a custom metric.
Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String domain; + private String id; + private String key; + private String name; + private String type; + + /** + * Description + * + * Example value: "Size of the team" + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Domain + * + * Example value: "Tests" + */ + public UpdateRequest setDomain(String domain) { + this.domain = domain; + return this; + } + + public String getDomain() { + return domain; + } + + /** + * Id of the custom metric to update + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Key + * + * Example value: "team_size" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name + * + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Metric type key + * + * Example value: "INT" + * Possible values: + *
    + *
  • "INT"
  • + *
  • "FLOAT"
  • + *
  • "PERCENT"
  • + *
  • "BOOL"
  • + *
  • "STRING"
  • + *
  • "MILLISEC"
  • + *
  • "DATA"
  • + *
  • "LEVEL"
  • + *
  • "DISTRIB"
  • + *
  • "RATING"
  • + *
  • "WORK_DUR"
  • + *
+ */ + public UpdateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/package-info.java new file mode 100644 index 00000000000..fc0260329a7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/metrics/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.metrics; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java new file mode 100644 index 00000000000..81f4d90acc1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get information concerning component navigation for the current user. Requires the 'Browse' permission on the component's project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ComponentRequest { + + private String branch; + private String component; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * A component key. + * + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java new file mode 100644 index 00000000000..dab4f8b267a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java @@ -0,0 +1,103 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information required to build navigation UI components + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class NavigationService extends BaseService { + + public NavigationService(WsConnector wsConnector) { + super(wsConnector, "api/navigation"); + } + + /** + * Get information concerning component navigation for the current user. Requires the 'Browse' permission on the component's project. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get information concerning global navigation for the current user. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String global() { + return call( + new GetRequest(path("global")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get information concerning organization navigation for the current user + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public String organization(OrganizationRequest request) { + return call( + new GetRequest(path("organization")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get configuration information for the settings page:
  • List plugin-contributed pages
  • Show update center (or not)
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String settings() { + return call( + new GetRequest(path("settings")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java new file mode 100644 index 00000000000..9479a1057f7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get information concerning organization navigation for the current user + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class OrganizationRequest { + + private String organization; + + /** + * the organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public OrganizationRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/package-info.java new file mode 100644 index 00000000000..c64db1d660c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/navigation/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.navigation; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java new file mode 100644 index 00000000000..559a71387d5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
  • System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddRequest { + + private String channel; + private String login; + private String project; + private String type; + + /** + * Channel through which the notification is sent. For example, notifications can be sent by email. + * + * Possible values: + *
    + *
  • "EmailNotificationChannel"
  • + *
+ */ + public AddRequest setChannel(String channel) { + this.channel = channel; + return this; + } + + public String getChannel() { + return channel; + } + + /** + * User login + * + */ + public AddRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Notification type. Possible values are for:
  • Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues
  • Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues
+ * + * This is a mandatory parameter. + * Example value: "SQ-MyNewIssues" + */ + public AddRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java new file mode 100644 index 00000000000..42106490d09 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List notifications of the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListRequest { + + private String login; + + /** + * User login + * + */ + public ListRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java new file mode 100644 index 00000000000..644822320cf --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java @@ -0,0 +1,94 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Notifications.ListResponse; + +/** + * Manage notifications of the authenticated user + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class NotificationsService extends BaseService { + + public NotificationsService(WsConnector wsConnector) { + super(wsConnector, "api/notifications"); + } + + /** + * Add a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
  • System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void add(AddRequest request) { + call( + new PostRequest(path("add")) + .setParam("channel", request.getChannel()) + .setParam("login", request.getLogin()) + .setParam("project", request.getProject()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List notifications of the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public ListResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("login", request.getLogin()), + ListResponse.parser()); + } + + /** + * Remove a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void remove(RemoveRequest request) { + call( + new PostRequest(path("remove")) + .setParam("channel", request.getChannel()) + .setParam("login", request.getLogin()) + .setParam("project", request.getProject()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java new file mode 100644 index 00000000000..9454a1ab018 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveRequest { + + private String channel; + private String login; + private String project; + private String type; + + /** + * Channel through which the notification is sent. For example, notifications can be sent by email. + * + * Possible values: + *
    + *
  • "EmailNotificationChannel"
  • + *
+ */ + public RemoveRequest setChannel(String channel) { + this.channel = channel; + return this; + } + + public String getChannel() { + return channel; + } + + /** + * User login + * + */ + public RemoveRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Notification type. Possible values are for:
  • Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues
  • Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues
+ * + * This is a mandatory parameter. + * Example value: "SQ-MyNewIssues" + */ + public RemoveRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/package-info.java new file mode 100644 index 00000000000..5123440ea4f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/notifications/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.notifications; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/OrchestratorService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/OrchestratorService.java new file mode 100644 index 00000000000..1b3ab00cf6b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/OrchestratorService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.orchestrator; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Orchestrator web service + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class OrchestratorService extends BaseService { + + public OrchestratorService(WsConnector wsConnector) { + super(wsConnector, "api/orchestrator"); + } + + /** + * Reset data + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since Orchestrator 3.4 + */ + public void reset() { + call( + new PostRequest(path("reset")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/package-info.java new file mode 100644 index 00000000000..304ce77322a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/orchestrator/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.orchestrator; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java new file mode 100644 index 00000000000..9ee8c8d90b0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a user as a member of an organization.
Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddMemberRequest { + + private String login; + private String organization; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "ray.bradbury" + */ + public AddMemberRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public AddMemberRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java new file mode 100644 index 00000000000..ae527450926 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create an organization.
Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String avatar; + private String description; + private String key; + private String name; + private String url; + + /** + * URL of the organization avatar.
It must be less than 256 chars long. + * + * Example value: "https://www.foo.com/foo.png" + */ + public CreateRequest setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getAvatar() { + return avatar; + } + + /** + * Description of the organization.
It must be less than 256 chars long. + * + * Example value: "The Foo company produces quality software for Bar." + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Key of the organization.
The key is unique to the whole SonarQube.
When not specified, the key is computed from the name.
Otherwise, it must be between 2 and 32 chars long. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading) + * + * Example value: "foo-company" + */ + public CreateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name of the organization.
It must be between 2 and 64 chars longs. + * + * This is a mandatory parameter. + * Example value: "Foo Company" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * URL of the organization.
It must be less than 256 chars long. + * + * Example value: "https://www.foo.com" + */ + public CreateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java new file mode 100644 index 00000000000..9361c11c150 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete an organization.
Require 'Administer System' permission on the specified organization. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String organization; + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java new file mode 100644 index 00000000000..9e3c8e8fa07 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java @@ -0,0 +1,215 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Organizations.AddMemberWsResponse; +import org.sonarqube.ws.Organizations.CreateWsResponse; +import org.sonarqube.ws.Organizations.SearchWsResponse; +import org.sonarqube.ws.Organizations.SearchMembersWsResponse; +import org.sonarqube.ws.Organizations.UpdateWsResponse; + +/** + * Manage organizations. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class OrganizationsService extends BaseService { + + public OrganizationsService(WsConnector wsConnector) { + super(wsConnector, "api/organizations"); + } + + /** + * Add a user as a member of an organization.
Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public AddMemberWsResponse addMember(AddMemberRequest request) { + return call( + new PostRequest(path("add_member")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()), + AddMemberWsResponse.parser()); + } + + /** + * Create an organization.
Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("avatar", request.getAvatar()) + .setParam("description", request.getDescription()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("url", request.getUrl()), + CreateWsResponse.parser()); + } + + /** + * Delete an organization.
Require 'Administer System' permission on the specified organization. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Enable support of organizations.
'Administer System' permission is required. The logged-in user will be flagged as root and will be able to manage organizations and other root users. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void enableSupport() { + call( + new PostRequest(path("enable_support")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a member from an organization.
Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public void removeMember(RemoveMemberRequest request) { + call( + new PostRequest(path("remove_member")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for organizations + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("organizations", request.getOrganizations() == null ? null : request.getOrganizations().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchWsResponse.parser()); + } + + /** + * Search members of an organization + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public SearchMembersWsResponse searchMembers(SearchMembersRequest request) { + return call( + new GetRequest(path("search_members")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()), + SearchMembersWsResponse.parser()); + } + + /** + * List keys of the organizations for which the currently authenticated user has the System Administer permission for. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public String searchMyOrganizations() { + return call( + new GetRequest(path("search_my_organizations")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update an organization.
Require 'Administer System' permission. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("avatar", request.getAvatar()) + .setParam("description", request.getDescription()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("url", request.getUrl()), + UpdateWsResponse.parser()); + } + + /** + * Update the default visibility for new projects of the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public void updateProjectVisibility(UpdateProjectVisibilityRequest request) { + call( + new PostRequest(path("update_project_visibility")) + .setParam("organization", request.getOrganization()) + .setParam("projectVisibility", request.getProjectVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java new file mode 100644 index 00000000000..f067f94cf0a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a member from an organization.
Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveMemberRequest { + + private String login; + private String organization; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "ray.bradbury" + */ + public RemoveMemberRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public RemoveMemberRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java new file mode 100644 index 00000000000..8969f5181a8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java @@ -0,0 +1,116 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search members of an organization + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchMembersRequest { + + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Organization key + * + * This is part of the internal API. + */ + public SearchMembersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchMembersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchMembersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "orwe" + */ + public SearchMembersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected). + * + * This is part of the internal API. + * Possible values: + *
    + *
  • "selected"
  • + *
  • "deselected"
  • + *
+ */ + public SearchMembersRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchRequest.java new file mode 100644 index 00000000000..9ad02a2b262 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/SearchRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for organizations + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List organizations; + private String p; + private String ps; + + /** + * Comma-separated list of organization keys + * + * Example value: "my-org-1,foocorp" + */ + public SearchRequest setOrganizations(List organizations) { + this.organizations = organizations; + return this; + } + + public List getOrganizations() { + return organizations; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java new file mode 100644 index 00000000000..7062eca7bb3 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java @@ -0,0 +1,72 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update the default visibility for new projects of the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateProjectVisibilityRequest { + + private String organization; + private String projectVisibility; + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public UpdateProjectVisibilityRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Default visibility for projects + * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "private"
  • + *
  • "public"
  • + *
+ */ + public UpdateProjectVisibilityRequest setProjectVisibility(String projectVisibility) { + this.projectVisibility = projectVisibility; + return this; + } + + public String getProjectVisibility() { + return projectVisibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java new file mode 100644 index 00000000000..9f956aa5550 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update an organization.
Require 'Administer System' permission. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String avatar; + private String description; + private String key; + private String name; + private String url; + + /** + * URL of the organization avatar.
It must be less than 256 chars long. + * + * Example value: "https://www.foo.com/foo.png" + */ + public UpdateRequest setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getAvatar() { + return avatar; + } + + /** + * Description of the organization.
It must be less than 256 chars long. + * + * Example value: "The Foo company produces quality software for Bar." + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name of the organization.
It must be between 2 and 64 chars longs. + * + * Example value: "Foo Company" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * URL of the organization.
It must be less than 256 chars long. + * + * Example value: "https://www.foo.com" + */ + public UpdateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/package-info.java new file mode 100644 index 00000000000..73e9af0ac8e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/organizations/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.organizations; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java new file mode 100644 index 00000000000..7c38e8658b3 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java @@ -0,0 +1,127 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add permission to a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group name or group id must be provided.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddGroupRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * Group id + * + * Example value: "42" + */ + public AddGroupRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public AddGroupRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + */ + public AddGroupRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public AddGroupRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddGroupRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java new file mode 100644 index 00000000000..900d2d187e4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java @@ -0,0 +1,135 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a group to a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddGroupToTemplateRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Group id + * + * Example value: "42" + */ + public AddGroupToTemplateRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public AddGroupToTemplateRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public AddGroupToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddGroupToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddGroupToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java new file mode 100644 index 00000000000..5bb44461454 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java @@ -0,0 +1,105 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a project creator to a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddProjectCreatorToTemplateRequest { + + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddProjectCreatorToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public AddProjectCreatorToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddProjectCreatorToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddProjectCreatorToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java new file mode 100644 index 00000000000..231e96d6e88 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java @@ -0,0 +1,113 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add permission to a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddUserRequest { + + private String login; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, cannot be used at the same time with projectId and projectKey + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + */ + public AddUserRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public AddUserRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddUserRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java new file mode 100644 index 00000000000..9f458d59c86 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java @@ -0,0 +1,121 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a user to a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddUserToTemplateRequest { + + private String login; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public AddUserToTemplateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public AddUserToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddUserToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddUserToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java new file mode 100644 index 00000000000..2989836dbe6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Apply a permission template to one project.
The project id or project key must be provided.
The template id or name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ApplyTemplateRequest { + + private String organization; + private String projectId; + private String projectKey; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ApplyTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public ApplyTemplateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public ApplyTemplateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ApplyTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public ApplyTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java new file mode 100644 index 00000000000..6579fcb3ea1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java @@ -0,0 +1,186 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Apply a permission template to several projects.
The template id or name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BulkApplyTemplateRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private List projects; + private String q; + private List qualifiers; + private String templateId; + private String templateName; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).
Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public BulkApplyTemplateRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + *
    + *
  • "true"
  • + *
  • "false"
  • + *
  • "yes"
  • + *
  • "no"
  • + *
+ */ + public BulkApplyTemplateRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public BulkApplyTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public BulkApplyTemplateRequest setProjects(List projects) { + this.projects = projects; + return this; + } + + public List getProjects() { + return projects; + } + + /** + * Limit search to:
  • project names that contain the supplied string
  • project keys that are exactly the same as the supplied string
+ * + * Example value: "apac" + */ + public BulkApplyTemplateRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:
  • TRK - Projects
+ * + * Possible values: + *
    + *
  • "TRK"
  • + *
+ */ + public BulkApplyTemplateRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public BulkApplyTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public BulkApplyTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).
If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + *
    + *
  • "private"
  • + *
  • "public"
  • + *
+ */ + public BulkApplyTemplateRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java new file mode 100644 index 00000000000..09c714c8965 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateTemplateRequest { + + private String description; + private String name; + private String organization; + private String projectKeyPattern; + + /** + * Description + * + * Example value: "Permissions for all projects related to the financial service" + */ + public CreateTemplateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "Financial Service Permissions" + */ + public CreateTemplateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key pattern. Must be a valid Java regular expression + * + * Example value: ".*\\.finance\\..*" + */ + public CreateTemplateRequest setProjectKeyPattern(String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } + + public String getProjectKeyPattern() { + return projectKeyPattern; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java new file mode 100644 index 00000000000..e50d6160e55 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteTemplateRequest { + + private String organization; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeleteTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public DeleteTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java new file mode 100644 index 00000000000..777a6563e7d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java @@ -0,0 +1,141 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Lists the groups with their permissions.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class GroupsRequest { + + private String organization; + private String p; + private String permission; + private String projectId; + private String projectKey; + private String ps; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public GroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + */ + public GroupsRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public GroupsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public GroupsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public GroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. When this parameter is not set, only groups having at least one permission are returned. + * + * Example value: "sonar" + */ + public GroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java new file mode 100644 index 00000000000..b5dda370883 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java @@ -0,0 +1,507 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Permissions.CreateTemplateWsResponse; +import org.sonarqube.ws.Permissions.WsGroupsResponse; +import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse; +import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; +import org.sonarqube.ws.Permissions.WsTemplateGroupsResponse; +import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; +import org.sonarqube.ws.Permissions.UsersWsResponse; + +/** + * Manage permission templates, and the granting and revoking of permissions at the global and project levels. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class PermissionsService extends BaseService { + + public PermissionsService(WsConnector wsConnector) { + super(wsConnector, "api/permissions"); + } + + /** + * Add permission to a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group name or group id must be provided.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addGroup(AddGroupRequest request) { + call( + new PostRequest(path("add_group")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a group to a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addGroupToTemplate(AddGroupToTemplateRequest request) { + call( + new PostRequest(path("add_group_to_template")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a project creator to a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ + public void addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest request) { + call( + new PostRequest(path("add_project_creator_to_template")) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add permission to a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a user to a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addUserToTemplate(AddUserToTemplateRequest request) { + call( + new PostRequest(path("add_user_to_template")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Apply a permission template to one project.
The project id or project key must be provided.
The template id or name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void applyTemplate(ApplyTemplateRequest request) { + call( + new PostRequest(path("apply_template")) + .setParam("organization", request.getOrganization()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Apply a permission template to several projects.
The template id or name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ + public void bulkApplyTemplate(BulkApplyTemplateRequest request) { + call( + new PostRequest(path("bulk_apply_template")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public CreateTemplateWsResponse createTemplate(CreateTemplateRequest request) { + return call( + new PostRequest(path("create_template")) + .setParam("description", request.getDescription()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("projectKeyPattern", request.getProjectKeyPattern()), + CreateTemplateWsResponse.parser()); + } + + /** + * Delete a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void deleteTemplate(DeleteTemplateRequest request) { + call( + new PostRequest(path("delete_template")) + .setParam("organization", request.getOrganization()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups with their permissions.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public WsGroupsResponse groups(GroupsRequest request) { + return call( + new GetRequest(path("groups")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + WsGroupsResponse.parser()); + } + + /** + * Remove a permission from a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group id or group name must be provided, not both.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeGroup(RemoveGroupRequest request) { + call( + new PostRequest(path("remove_group")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a group from a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeGroupFromTemplate(RemoveGroupFromTemplateRequest request) { + call( + new PostRequest(path("remove_group_from_template")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a project creator from a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ + public void removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest request) { + call( + new PostRequest(path("remove_project_creator_from_template")) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove permission from a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a user from a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeUserFromTemplate(RemoveUserFromTemplateRequest request) { + call( + new PostRequest(path("remove_user_from_template")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List global permissions.
Requires the following permission: 'Administer System' + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + * @deprecated since 6.5 + */ + @Deprecated + public WsSearchGlobalPermissionsResponse searchGlobalPermissions(SearchGlobalPermissionsRequest request) { + return call( + new GetRequest(path("search_global_permissions")) + .setParam("organization", request.getOrganization()), + WsSearchGlobalPermissionsResponse.parser()); + } + + /** + * List project permissions. A project can be a technical project, a view or a developer.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + * @deprecated since 6.5 + */ + @Deprecated + public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsRequest request) { + return call( + new GetRequest(path("search_project_permissions")) + .setParam("p", request.getP()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifier", request.getQualifier()), + SearchProjectPermissionsWsResponse.parser()); + } + + /** + * List permission templates.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public SearchTemplatesWsResponse searchTemplates(SearchTemplatesRequest request) { + return call( + new GetRequest(path("search_templates")) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()), + SearchTemplatesWsResponse.parser()); + } + + /** + * Set a permission template as default.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void setDefaultTemplate(SetDefaultTemplateRequest request) { + call( + new PostRequest(path("set_default_template")) + .setParam("organization", request.getOrganization()) + .setParam("qualifier", request.getQualifier()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.
This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public WsTemplateGroupsResponse templateGroups(TemplateGroupsRequest request) { + return call( + new GetRequest(path("template_groups")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()), + WsTemplateGroupsResponse.parser()); + } + + /** + * Lists the users with their permission as individual users rather than through group affiliation on the chosen template.
This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String templateUsers(TemplateUsersRequest request) { + return call( + new GetRequest(path("template_users")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public UpdateTemplateWsResponse updateTemplate(UpdateTemplateRequest request) { + return call( + new PostRequest(path("update_template")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("projectKeyPattern", request.getProjectKeyPattern()), + UpdateTemplateWsResponse.parser()); + } + + /** + * Lists the users with their permissions as individual users rather than through group affiliation.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public UsersWsResponse users(UsersRequest request) { + return call( + new GetRequest(path("users")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + UsersWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java new file mode 100644 index 00000000000..69bf713d4e7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java @@ -0,0 +1,135 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a group from a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveGroupFromTemplateRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveGroupFromTemplateRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public RemoveGroupFromTemplateRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public RemoveGroupFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveGroupFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveGroupFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java new file mode 100644 index 00000000000..6bd141b39f0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java @@ -0,0 +1,127 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a permission from a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group id or group name must be provided, not both.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveGroupRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveGroupRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public RemoveGroupRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + */ + public RemoveGroupRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public RemoveGroupRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveGroupRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java new file mode 100644 index 00000000000..b7670c13d17 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java @@ -0,0 +1,105 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a project creator from a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveProjectCreatorFromTemplateRequest { + + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveProjectCreatorFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public RemoveProjectCreatorFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveProjectCreatorFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveProjectCreatorFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java new file mode 100644 index 00000000000..125e3fc5614 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java @@ -0,0 +1,121 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a user from a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveUserFromTemplateRequest { + + private String login; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public RemoveUserFromTemplateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public RemoveUserFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveUserFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveUserFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java new file mode 100644 index 00000000000..c96968a363e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java @@ -0,0 +1,113 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove permission from a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveUserRequest { + + private String login; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + */ + public RemoveUserRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public RemoveUserRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveUserRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java new file mode 100644 index 00000000000..984e7eb2be6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List global permissions.
Requires the following permission: 'Administer System' + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchGlobalPermissionsRequest { + + private String organization; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchGlobalPermissionsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java new file mode 100644 index 00000000000..8681ac84b89 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java @@ -0,0 +1,129 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List project permissions. A project can be a technical project, a view or a developer.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchProjectPermissionsRequest { + + private String p; + private String projectId; + private String projectKey; + private String ps; + private String q; + private String qualifier; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchProjectPermissionsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public SearchProjectPermissionsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchProjectPermissionsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchProjectPermissionsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
  • project names that contain the supplied string
  • project keys that are exactly the same as the supplied string
+ * + * Example value: "apac" + */ + public SearchProjectPermissionsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Project qualifier. Filter the results with the specified qualifier. Possible values are:
  • TRK - Projects
+ * + * Possible values: + *
    + *
  • "TRK"
  • + *
+ */ + public SearchProjectPermissionsRequest setQualifier(String qualifier) { + this.qualifier = qualifier; + return this; + } + + public String getQualifier() { + return qualifier; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java new file mode 100644 index 00000000000..ddfaa9a05a6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List permission templates.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchTemplatesRequest { + + private String organization; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchTemplatesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Limit search to permission template names that contain the supplied string. + * + * Example value: "defau" + */ + public SearchTemplatesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java new file mode 100644 index 00000000000..bfe26955b87 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java @@ -0,0 +1,100 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set a permission template as default.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetDefaultTemplateRequest { + + private String organization; + private String qualifier; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SetDefaultTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project qualifier. Filter the results with the specified qualifier. Possible values are:
  • TRK - Projects
+ * + * Possible values: + *
    + *
  • "TRK"
  • + *
+ */ + public SetDefaultTemplateRequest setQualifier(String qualifier) { + this.qualifier = qualifier; + return this; + } + + public String getQualifier() { + return qualifier; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetDefaultTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public SetDefaultTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java new file mode 100644 index 00000000000..3f25827aa6c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java @@ -0,0 +1,150 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.
This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TemplateGroupsRequest { + + private String organization; + private String p; + private String permission; + private String ps; + private String q; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TemplateGroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TemplateGroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * This is a mandatory parameter. + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public TemplateGroupsRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TemplateGroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string.
When this parameter is not set, only group having at least one permission are returned. + * + * Example value: "eri" + */ + public TemplateGroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TemplateGroupsRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public TemplateGroupsRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java new file mode 100644 index 00000000000..78072d29d4c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java @@ -0,0 +1,149 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Lists the users with their permission as individual users rather than through group affiliation on the chosen template.
This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TemplateUsersRequest { + + private String organization; + private String p; + private String permission; + private String ps; + private String q; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TemplateUsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TemplateUsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + * Possible values: + *
    + *
  • "admin"
  • + *
  • "codeviewer"
  • + *
  • "issueadmin"
  • + *
  • "scan"
  • + *
  • "user"
  • + *
+ */ + public TemplateUsersRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TemplateUsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to user names that contain the supplied string.
When this parameter is not set, only users having at least one permission are returned. + * + * Example value: "eri" + */ + public TemplateUsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TemplateUsersRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public TemplateUsersRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java new file mode 100644 index 00000000000..2b1d93a7409 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a permission template.
Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateTemplateRequest { + + private String description; + private String id; + private String name; + private String projectKeyPattern; + + /** + * Description + * + * Example value: "Permissions for all projects related to the financial service" + */ + public UpdateTemplateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Id + * + * This is a mandatory parameter. + * Example value: "af8cb8cc-1e78-4c4e-8c00-ee8e814009a5" + */ + public UpdateTemplateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Name + * + * Example value: "Financial Service Permissions" + */ + public UpdateTemplateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project key pattern. Must be a valid Java regular expression + * + * Example value: ".*\\.finance\\..*" + */ + public UpdateTemplateRequest setProjectKeyPattern(String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } + + public String getProjectKeyPattern() { + return projectKeyPattern; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java new file mode 100644 index 00000000000..c5a9dae5f81 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java @@ -0,0 +1,141 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Lists the users with their permissions as individual users rather than through group affiliation.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
+ * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UsersRequest { + + private String organization; + private String p; + private String permission; + private String projectId; + private String projectKey; + private String ps; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public UsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission
  • Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning
  • Possible values for project permissions admin, codeviewer, issueadmin, scan, user
+ * + */ + public UsersRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public UsersRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public UsersRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public UsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to user names that contain the supplied string.
When this parameter is not set, only users having at least one permission are returned. + * + * Example value: "eri" + */ + public UsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/package-info.java new file mode 100644 index 00000000000..c2d92162d1f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/permissions/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.permissions; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java new file mode 100644 index 00000000000..1d3a5791e01 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Installs the latest version of a plugin specified by its key.
Plugin information is retrieved from Update Center.
Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class InstallRequest { + + private String key; + + /** + * The key identifying the plugin to install + * + * This is a mandatory parameter. + */ + public InstallRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java new file mode 100644 index 00000000000..07ae1d5ea27 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java @@ -0,0 +1,54 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class InstalledRequest { + + private List f; + + /** + * Comma-separated list of the additional fields to be returned in response. No additional field is returned by default. Possible values are:
  • category - category as defined in the Update Center. A connection to the Update Center is needed
  • + * + * Possible values: + *
      + *
    • "category"
    • + *
    + */ + public InstalledRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java new file mode 100644 index 00000000000..0a9dbe0716e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java @@ -0,0 +1,164 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage the plugins on the server, including installing, uninstalling, and upgrading. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class PluginsService extends BaseService { + + public PluginsService(WsConnector wsConnector) { + super(wsConnector, "api/plugins"); + } + + /** + * Get the list of all the plugins available for installation on the SonarQube instance, sorted by plugin name.
    Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.
    Update status values are:
    • COMPATIBLE: plugin is compatible with current SonarQube instance.
    • INCOMPATIBLE: plugin is not compatible with current SonarQube instance.
    • REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.
    • DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.
    Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String available() { + return call( + new GetRequest(path("available")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Cancels any operation pending on any plugin (install, update or uninstall)
    Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void cancelAll() { + call( + new PostRequest(path("cancel_all")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Installs the latest version of a plugin specified by its key.
    Plugin information is retrieved from Update Center.
    Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void install(InstallRequest request) { + call( + new PostRequest(path("install")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String installed(InstalledRequest request) { + return call( + new GetRequest(path("installed")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of plugins which will either be installed or removed at the next startup of the SonarQube instance, sorted by plugin name.
    Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String pending() { + return call( + new GetRequest(path("pending")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Uninstalls the plugin specified by its key.
    Requires user to be authenticated with Administer System permissions. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void uninstall(UninstallRequest request) { + call( + new PostRequest(path("uninstall")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Updates a plugin specified by its key to the latest version compatible with the SonarQube instance.
    Plugin information is retrieved from Update Center.
    Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists plugins installed on the SonarQube instance for which at least one newer version is available, sorted by plugin name.
    Each newer version is listed, ordered from the oldest to the newest, with its own update/compatibility status.
    Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.
    Update status values are: [COMPATIBLE, INCOMPATIBLE, REQUIRES_UPGRADE, DEPS_REQUIRE_UPGRADE].
    Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String updates() { + return call( + new GetRequest(path("updates")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java new file mode 100644 index 00000000000..dc6e0f58e72 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Uninstalls the plugin specified by its key.
    Requires user to be authenticated with Administer System permissions. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UninstallRequest { + + private String key; + + /** + * The key identifying the plugin to uninstall + * + * This is a mandatory parameter. + */ + public UninstallRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java new file mode 100644 index 00000000000..e2a91d17352 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Updates a plugin specified by its key to the latest version compatible with the SonarQube instance.
    Plugin information is retrieved from Update Center.
    Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String key; + + /** + * The key identifying the plugin to update + * + * This is a mandatory parameter. + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/package-info.java new file mode 100644 index 00000000000..d5fcdab6ddf --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/plugins/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.plugins; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java new file mode 100644 index 00000000000..e533a502770 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.profiles; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/qualityprofiles instead + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProfilesService extends BaseService { + + public ProfilesService(WsConnector wsConnector) { + super(wsConnector, "api/profiles"); + } + + /** + * Get a profile.
    The web service is removed and you're invited to use api/qualityprofiles/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 3.3 + * @deprecated since 5.2 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get a list of profiles.
    The web service is removed and you're invited to use api/qualityprofiles/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 3.3 + * @deprecated since 5.2 + */ + @Deprecated + public String list() { + return call( + new GetRequest(path("list")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/package-info.java new file mode 100644 index 00000000000..1d4569b89bc --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/profiles/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.profiles; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java new file mode 100644 index 00000000000..1cd2ab10fdc --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java @@ -0,0 +1,87 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a project analysis event.
    Only event of category 'VERSION' and 'OTHER' can be created.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateEventRequest { + + private String analysis; + private String category; + private String name; + + /** + * Analysis key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CreateEventRequest setAnalysis(String analysis) { + this.analysis = analysis; + return this; + } + + public String getAnalysis() { + return analysis; + } + + /** + * Category + * + * Possible values: + *
      + *
    • "VERSION"
    • + *
    • "OTHER"
    • + *
    + */ + public CreateEventRequest setCategory(String category) { + this.category = category; + return this; + } + + public String getCategory() { + return category; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "5.6" + */ + public CreateEventRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java new file mode 100644 index 00000000000..eafd06f4f38 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a project analysis event.
    Only event of category 'VERSION' and 'OTHER' can be deleted.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteEventRequest { + + private String event; + + /** + * Event key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public DeleteEventRequest setEvent(String event) { + this.event = event; + return this; + } + + public String getEvent() { + return event; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java new file mode 100644 index 00000000000..1691f6af1a3 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a project analysis.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the project of the specified analysis
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String analysis; + + /** + * Analysis key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public DeleteRequest setAnalysis(String analysis) { + this.analysis = analysis; + return this; + } + + public String getAnalysis() { + return analysis; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java new file mode 100644 index 00000000000..6538f888f8f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.ProjectAnalyses.CreateEventResponse; +import org.sonarqube.ws.ProjectAnalyses.SearchResponse; +import org.sonarqube.ws.ProjectAnalyses.UpdateEventResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage project analyses. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectAnalysesService extends BaseService { + + public ProjectAnalysesService(WsConnector wsConnector) { + super(wsConnector, "api/project_analyses"); + } + + /** + * Create a project analysis event.
    Only event of category 'VERSION' and 'OTHER' can be created.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public CreateEventResponse createEvent(CreateEventRequest request) { + return call( + new PostRequest(path("create_event")) + .setParam("analysis", request.getAnalysis()) + .setParam("category", request.getCategory()) + .setParam("name", request.getName()), + CreateEventResponse.parser()); + } + + /** + * Delete a project analysis.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the project of the specified analysis
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("analysis", request.getAnalysis()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a project analysis event.
    Only event of category 'VERSION' and 'OTHER' can be deleted.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public void deleteEvent(DeleteEventRequest request) { + call( + new PostRequest(path("delete_event")) + .setParam("event", request.getEvent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search a project analyses and attached events.
    Requires the following permission: 'Browse' on the specified project + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("branch", request.getBranch()) + .setParam("category", request.getCategory()) + .setParam("from", request.getFrom()) + .setParam("p", request.getP()) + .setParam("project", request.getProject()) + .setParam("ps", request.getPs()) + .setParam("to", request.getTo()), + SearchResponse.parser()); + } + + /** + * Update a project analysis event.
    Only events of category 'VERSION' and 'OTHER' can be updated.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public UpdateEventResponse updateEvent(UpdateEventRequest request) { + return call( + new PostRequest(path("update_event")) + .setParam("event", request.getEvent()) + .setParam("name", request.getName()), + UpdateEventResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java new file mode 100644 index 00000000000..3e2c6107a3d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java @@ -0,0 +1,150 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search a project analyses and attached events.
    Requires the following permission: 'Browse' on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String branch; + private String category; + private String from; + private String p; + private String project; + private String ps; + private String to; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Event category. Filter analyses that have at least one event of the category specified. + * + * Example value: "OTHER" + * Possible values: + *
      + *
    • "VERSION"
    • + *
    • "OTHER"
    • + *
    • "QUALITY_PROFILE"
    • + *
    • "QUALITY_GATE"
    • + *
    + */ + public SearchRequest setCategory(String category) { + this.category = category; + return this; + } + + public String getCategory() { + return category; + } + + /** + * Filter analyses created after the given date (inclusive).
    Either a date (server timezone) or datetime can be provided + * + * Example value: "2013-05-01" + */ + public SearchRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SearchRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter analyses created before the given date (inclusive).
    Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java new file mode 100644 index 00000000000..a2de46e2c8e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a project analysis event.
    Only events of category 'VERSION' and 'OTHER' can be updated.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateEventRequest { + + private String event; + private String name; + + /** + * Event key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL5" + */ + public UpdateEventRequest setEvent(String event) { + this.event = event; + return this; + } + + public String getEvent() { + return event; + } + + /** + * New name + * + * Example value: "5.6" + */ + public UpdateEventRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java new file mode 100644 index 00000000000..81b12f75d62 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectanalyses; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java new file mode 100644 index 00000000000..5ad926e589b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 java.util.List; +import javax.annotation.Generated; + +/** + * Delete a non-main branch of a project.
    Requires 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String branch; + private String project; + + /** + * Name of the branch + * + * This is a mandatory parameter. + * Example value: "branch1" + */ + public DeleteRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public DeleteRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java new file mode 100644 index 00000000000..fe0e8d6eb55 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 java.util.List; +import javax.annotation.Generated; + +/** + * List the branches of a project.
    Requires 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListRequest { + + private String project; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public ListRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java new file mode 100644 index 00000000000..88574ee92be --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java @@ -0,0 +1,90 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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; + +/** + * Manage branch (only available when the Branch plugin is installed) + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectBranchesService extends BaseService { + + public ProjectBranchesService(WsConnector wsConnector) { + super(wsConnector, "api/project_branches"); + } + + /** + * Delete a non-main branch of a project.
    Requires 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public String delete(DeleteRequest request) { + return call( + new PostRequest(path("delete")) + .setParam("branch", request.getBranch()) + .setParam("project", request.getProject()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the branches of a project.
    Requires 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public ListWsResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("project", request.getProject()), + ListWsResponse.parser()); + } + + /** + * Rename the main branch of a project.
    Requires 'Administer' permission on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("name", request.getName()) + .setParam("project", request.getProject()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java new file mode 100644 index 00000000000..8e46ea6a5a8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 java.util.List; +import javax.annotation.Generated; + +/** + * Rename the main branch of a project.
    Requires 'Administer' permission on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RenameRequest { + + private String name; + private String project; + + /** + * New name of the main branch + * + * This is a mandatory parameter. + * Example value: "branch1" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public RenameRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java new file mode 100644 index 00000000000..148ff98162a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectbranches; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java new file mode 100644 index 00000000000..3bc7227dc62 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a new project link.
    Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String name; + private String projectId; + private String projectKey; + private String url; + + /** + * Link name + * + * This is a mandatory parameter. + * Example value: "Custom" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CreateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public CreateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Link url + * + * This is a mandatory parameter. + * Example value: "http://example.com" + */ + public CreateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java new file mode 100644 index 00000000000..c2f57ce0e14 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete existing project link.
    Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String id; + + /** + * Link id + * + * This is a mandatory parameter. + * Example value: "17" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java new file mode 100644 index 00000000000..c452f739cea --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java @@ -0,0 +1,92 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.ProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; + +/** + * Manage projects links. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectLinksService extends BaseService { + + public ProjectLinksService(WsConnector wsConnector) { + super(wsConnector, "api/project_links"); + } + + /** + * Create a new project link.
    Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("name", request.getName()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("url", request.getUrl()), + CreateWsResponse.parser()); + } + + /** + * Delete existing project link.
    Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List links of a project.
    The 'projectId' or 'projectKey' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    • 'Browse' on the specified project
    + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()), + SearchWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java new file mode 100644 index 00000000000..03a06ff7ee8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List links of a project.
    The 'projectId' or 'projectKey' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    • 'Browse' on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String projectId; + private String projectKey; + + /** + * Project Id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SearchRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project Key + * + * Example value: "my_project" + */ + public SearchRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java new file mode 100644 index 00000000000..01d51ffb385 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectlinks; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java new file mode 100644 index 00000000000..1bcfada7bdf --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java @@ -0,0 +1,174 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete one or several projects.
    Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BulkDeleteRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private List projectIds; + private List projects; + private String q; + private List qualifiers; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).
    Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public BulkDeleteRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + *
      + *
    • "true"
    • + *
    • "false"
    • + *
    • "yes"
    • + *
    • "no"
    • + *
    + */ + public BulkDeleteRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public BulkDeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Comma-separated list of project ids + * + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.4 + */ + @Deprecated + public BulkDeleteRequest setProjectIds(List projectIds) { + this.projectIds = projectIds; + return this; + } + + public List getProjectIds() { + return projectIds; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public BulkDeleteRequest setProjects(List projects) { + this.projects = projects; + return this; + } + + public List getProjects() { + return projects; + } + + /** + * Limit to:
    • component names that contain the supplied string
    • component keys that contain the supplied string
    + * + * Example value: "sonar" + */ + public BulkDeleteRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers + * + * Possible values: + *
      + *
    • "TRK"
    • + *
    • "VW"
    • + *
    • "APP"
    • + *
    + */ + public BulkDeleteRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).
    If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + *
      + *
    • "private"
    • + *
    • "public"
    • + *
    + */ + public BulkDeleteRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java new file mode 100644 index 00000000000..29cc0fc67ed --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java @@ -0,0 +1,121 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk update a project or module key and all its sub-components keys. The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.
    It's possible to simulate the bulk update by setting the parameter 'dryRun' at true. No key is updated with a dry run.
    Ex: to rename a project with key 'my_project' to 'my_new_project' and all its sub-components keys, call the WS with parameters:
    • project: my_project
    • from: my_
    • to: my_new_
    Either 'projectId' or 'project' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BulkUpdateKeyRequest { + + private String dryRun; + private String from; + private String project; + private String projectId; + private String to; + + /** + * Simulate bulk update. No component key is updated. + * + * Possible values: + *
      + *
    • "true"
    • + *
    • "false"
    • + *
    • "yes"
    • + *
    • "no"
    • + *
    + */ + public BulkUpdateKeyRequest setDryRun(String dryRun) { + this.dryRun = dryRun; + return this; + } + + public String getDryRun() { + return dryRun; + } + + /** + * String to match in components keys + * + * This is a mandatory parameter. + * Example value: "_old" + */ + public BulkUpdateKeyRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Project or module key + * + * Example value: "my_old_project" + */ + public BulkUpdateKeyRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project or module ID + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public BulkUpdateKeyRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * String replacement in components keys + * + * This is a mandatory parameter. + * Example value: "_new" + */ + public BulkUpdateKeyRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java new file mode 100644 index 00000000000..c5b802f645b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a project.
    Requires 'Create Projects' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String branch; + private String name; + private String organization; + private String project; + private String visibility; + + /** + * SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0' + * + * Example value: "branch-5.0" + */ + public CreateRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Name of the project + * + * This is a mandatory parameter. + * Example value: "SonarQube" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Key of the project + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public CreateRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Whether the created project should be visible to everyone, or only specific user/groups.
    If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + *
      + *
    • "private"
    • + *
    • "public"
    • + *
    + */ + public CreateRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java new file mode 100644 index 00000000000..8db800423d5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a project.
    Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String project; + private String projectId; + + /** + * Project key + * + * Example value: "my_project" + */ + public DeleteRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + * @deprecated since 6.4 + */ + @Deprecated + public DeleteRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java new file mode 100644 index 00000000000..cd8bd1b8352 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List ghost projects.
    With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.
    Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class GhostsRequest { + + private List f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
      + *
    • "name"
    • + *
    • "creationDate"
    • + *
    • "visibility"
    • + *
    • "uuid"
    • + *
    • "key"
    • + *
    + */ + public GhostsRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * Organization key + * + * This is part of the internal API. + */ + public GhostsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GhostsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public GhostsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or keys that contain the supplied string. + * + * Example value: "sonar" + */ + public GhostsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java new file mode 100644 index 00000000000..1c6f694d621 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java @@ -0,0 +1,169 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * This web service is deprecated, please use api/components/search instead + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 2.10 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IndexRequest { + + private String desc; + private String format; + private String libs; + private String project; + private String search; + private String subprojects; + private String versions; + private String views; + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setDesc(String desc) { + this.desc = desc; + return this; + } + + public String getDesc() { + return desc; + } + + /** + * Only json response format is available + * + * Possible values: + *
      + *
    • "json"
    • + *
    + */ + public IndexRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setLibs(String libs) { + this.libs = libs; + return this; + } + + public String getLibs() { + return libs; + } + + /** + * key or ID of the project + * + * Example value: "my_project" + */ + public IndexRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Substring of project name, case insensitive. Ignored if the parameter key is set + * + * Example value: "Sonar" + */ + public IndexRequest setSearch(String search) { + this.search = search; + return this; + } + + public String getSearch() { + return search; + } + + /** + * Load sub-projects. Ignored if the parameter key is set + * + * Possible values: + *
      + *
    • "true"
    • + *
    • "false"
    • + *
    • "yes"
    • + *
    • "no"
    • + *
    + */ + public IndexRequest setSubprojects(String subprojects) { + this.subprojects = subprojects; + return this; + } + + public String getSubprojects() { + return subprojects; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setVersions(String versions) { + this.versions = versions; + return this; + } + + public String getVersions() { + return versions; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setViews(String views) { + this.views = views; + return this; + } + + public String getViews() { + return views; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java new file mode 100644 index 00000000000..b5b1a5a755c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java @@ -0,0 +1,266 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Projects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse; + +/** + * Manage project existence. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectsService extends BaseService { + + public ProjectsService(WsConnector wsConnector) { + super(wsConnector, "api/projects"); + } + + /** + * Delete one or several projects.
    Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void bulkDelete(BulkDeleteRequest request) { + call( + new PostRequest(path("bulk_delete")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("projectIds", request.getProjectIds() == null ? null : request.getProjectIds().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk update a project or module key and all its sub-components keys. The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.
    It's possible to simulate the bulk update by setting the parameter 'dryRun' at true. No key is updated with a dry run.
    Ex: to rename a project with key 'my_project' to 'my_new_project' and all its sub-components keys, call the WS with parameters:
    • project: my_project
    • from: my_
    • to: my_new_
    Either 'projectId' or 'project' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyRequest request) { + return call( + new PostRequest(path("bulk_update_key")) + .setParam("dryRun", request.getDryRun()) + .setParam("from", request.getFrom()) + .setParam("project", request.getProject()) + .setParam("projectId", request.getProjectId()) + .setParam("to", request.getTo()), + BulkUpdateKeyWsResponse.parser()); + } + + /** + * Create a project.
    Requires 'Create Projects' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.0 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("branch", request.getBranch()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("visibility", request.getVisibility()), + CreateWsResponse.parser()); + } + + /** + * Delete a project.
    Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("project", request.getProject()) + .setParam("projectId", request.getProjectId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List ghost projects.
    With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.
    Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + * @deprecated since 6.6 + */ + @Deprecated + public String ghosts(GhostsRequest request) { + return call( + new GetRequest(path("ghosts")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * This web service is deprecated, please use api/components/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("desc", request.getDesc()) + .setParam("format", request.getFormat()) + .setParam("libs", request.getLibs()) + .setParam("project", request.getProject()) + .setParam("search", request.getSearch()) + .setParam("subprojects", request.getSubprojects()) + .setParam("versions", request.getVersions()) + .setParam("views", request.getViews()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of provisioned projects.
    Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.
    Require 'Create Projects' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + * @deprecated since 6.6 + */ + @Deprecated + public String provisioned(ProvisionedRequest request) { + return call( + new GetRequest(path("provisioned")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for projects or views to administrate them.
    Requires 'System Administrator' permission + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("projectIds", request.getProjectIds() == null ? null : request.getProjectIds().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("visibility", request.getVisibility()), + SearchWsResponse.parser()); + } + + /** + * Return list of projects for which the current user has 'Administer' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ + public SearchMyProjectsWsResponse searchMyProjects(SearchMyProjectsRequest request) { + return call( + new GetRequest(path("search_my_projects")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchMyProjectsWsResponse.parser()); + } + + /** + * Update a project or module key and all its sub-components keys.
    Either 'from' or 'projectId' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public void updateKey(UpdateKeyRequest request) { + call( + new PostRequest(path("update_key")) + .setParam("from", request.getFrom()) + .setParam("projectId", request.getProjectId()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Updates visibility of a project.
    Requires 'Project administer' permission on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public void updateVisibility(UpdateVisibilityRequest request) { + call( + new PostRequest(path("update_visibility")) + .setParam("project", request.getProject()) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java new file mode 100644 index 00000000000..e382c2151f0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of provisioned projects.
    Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.
    Require 'Create Projects' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProvisionedRequest { + + private List f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
      + *
    • "name"
    • + *
    • "creationDate"
    • + *
    • "visibility"
    • + *
    • "uuid"
    • + *
    • "key"
    • + *
    + */ + public ProvisionedRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public ProvisionedRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ProvisionedRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ProvisionedRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or keys that contain the supplied string. + * + * Example value: "sonar" + */ + public ProvisionedRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java new file mode 100644 index 00000000000..345becd817a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return list of projects for which the current user has 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchMyProjectsRequest { + + private String p; + private String ps; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchMyProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchMyProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java new file mode 100644 index 00000000000..b40a5add9b0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java @@ -0,0 +1,204 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for projects or views to administrate them.
    Requires 'System Administrator' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private String p; + private List projectIds; + private List projects; + private String ps; + private String q; + private List qualifiers; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).
    Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + *
      + *
    • "true"
    • + *
    • "false"
    • + *
    • "yes"
    • + *
    • "no"
    • + *
    + */ + public SearchRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Comma-separated list of project ids + * + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public SearchRequest setProjectIds(List projectIds) { + this.projectIds = projectIds; + return this; + } + + public List getProjectIds() { + return projectIds; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public SearchRequest setProjects(List projects) { + this.projects = projects; + return this; + } + + public List getProjects() { + return projects; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to:
    • component names that contain the supplied string
    • component keys that contain the supplied string
    + * + * Example value: "sonar" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers + * + * Possible values: + *
      + *
    • "TRK"
    • + *
    • "VW"
    • + *
    • "APP"
    • + *
    + */ + public SearchRequest setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).
    If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + *
      + *
    • "private"
    • + *
    • "public"
    • + *
    + */ + public SearchRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java new file mode 100644 index 00000000000..afd408e2ad6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a project or module key and all its sub-components keys.
    Either 'from' or 'projectId' must be provided.
    Requires one of the following permissions:
    • 'Administer System'
    • 'Administer' rights on the specified project
    + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateKeyRequest { + + private String from; + private String projectId; + private String to; + + /** + * Project or module key + * + * Example value: "my_old_project" + */ + public UpdateKeyRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Project or module id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public UpdateKeyRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * New component key + * + * This is a mandatory parameter. + * Example value: "my_new_project" + */ + public UpdateKeyRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java new file mode 100644 index 00000000000..91a3bd4affe --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java @@ -0,0 +1,72 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Updates visibility of a project.
    Requires 'Project administer' permission on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateVisibilityRequest { + + private String project; + private String visibility; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public UpdateVisibilityRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * New visibility + * + * This is a mandatory parameter. + * Possible values: + *
      + *
    • "private"
    • + *
    • "public"
    • + *
    + */ + public UpdateVisibilityRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/package-info.java new file mode 100644 index 00000000000..0e38452b189 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projects/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projects; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java new file mode 100644 index 00000000000..f529921c50f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.ProjectTags.SearchResponse; + +/** + * Manage project tags + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectTagsService extends BaseService { + + public ProjectTagsService(WsConnector wsConnector) { + super(wsConnector, "api/project_tags"); + } + + /** + * Search tags + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchResponse.parser()); + } + + /** + * Set tags on a project.
    Requires the following permission: 'Administer' rights on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ + public void set(SetRequest request) { + call( + new PostRequest(path("set")) + .setParam("project", request.getProject()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java new file mode 100644 index 00000000000..77739b85c7c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search tags + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String ps; + private String q; + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "off" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java new file mode 100644 index 00000000000..ddb582ab5d9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set tags on a project.
    Requires the following permission: 'Administer' rights on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetRequest { + + private String project; + private List tags; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SetRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Comma-separated list of tags + * + * This is a mandatory parameter. + * Example value: "finance, offshore" + */ + public SetRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java new file mode 100644 index 00000000000..f2bb28b5447 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projecttags; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java new file mode 100644 index 00000000000..632277b9c93 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.properties; + +import java.util.List; +import javax.annotation.Generated; + +/** + * This web service is deprecated, please use api/settings/values instead. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 2.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IndexRequest { + + private String format; + private String id; + private String resource; + + /** + * Only json response format is available + * + * Possible values: + *
      + *
    • "json"
    • + *
    + */ + public IndexRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } + + /** + * Setting key + * + * Example value: "sonar.test.inclusions" + */ + public IndexRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Component key or database id + * + * Example value: "my_project" + */ + public IndexRequest setResource(String resource) { + this.resource = resource; + return this; + } + + public String getResource() { + return resource; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java new file mode 100644 index 00000000000..d815029c79b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java @@ -0,0 +1,60 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.properties; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * This web service is deprecated, please use api/settings instead. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class PropertiesService extends BaseService { + + public PropertiesService(WsConnector wsConnector) { + super(wsConnector, "api/properties"); + } + + /** + * This web service is deprecated, please use api/settings/values instead. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("format", request.getFormat()) + .setParam("id", request.getId()) + .setParam("resource", request.getResource()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/package-info.java new file mode 100644 index 00000000000..9c38b2f7e4c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/properties/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.properties; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java new file mode 100644 index 00000000000..64df4734db7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Copy a Quality Gate.
    Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CopyRequest { + + private String id; + private String name; + + /** + * The ID of the source quality gate + * + * This is a mandatory parameter. + * Example value: "1" + */ + public CopyRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * The name of the quality gate to create + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public CopyRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java new file mode 100644 index 00000000000..c91aa6b3713 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java @@ -0,0 +1,138 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a new condition to a quality gate.
    Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateConditionRequest { + + private String error; + private String gateId; + private String metric; + private String op; + private String period; + private String warning; + + /** + * Condition error threshold + * + * Example value: "10" + */ + public CreateConditionRequest setError(String error) { + this.error = error; + return this; + } + + public String getError() { + return error; + } + + /** + * ID of the quality gate + * + * This is a mandatory parameter. + * Example value: "1" + */ + public CreateConditionRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Condition metric + * + * This is a mandatory parameter. + * Example value: "blocker_violations" + */ + public CreateConditionRequest setMetric(String metric) { + this.metric = metric; + return this; + } + + public String getMetric() { + return metric; + } + + /** + * Condition operator:
    • EQ = equals
    • NE = is not
    • LT = is lower than
    • GT = is greater than
    • + * + * Example value: "EQ" + * Possible values: + *
        + *
      • "LT"
      • + *
      • "GT"
      • + *
      • "EQ"
      • + *
      • "NE"
      • + *
      + */ + public CreateConditionRequest setOp(String op) { + this.op = op; + return this; + } + + public String getOp() { + return op; + } + + /** + * Condition period. If not set, the absolute value is considered. + * + * Possible values: + *
        + *
      • "1"
      • + *
      + */ + public CreateConditionRequest setPeriod(String period) { + this.period = period; + return this; + } + + public String getPeriod() { + return period; + } + + /** + * Condition warning threshold + * + * Example value: "5" + */ + public CreateConditionRequest setWarning(String warning) { + this.warning = warning; + return this; + } + + public String getWarning() { + return warning; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java new file mode 100644 index 00000000000..72bbe43e679 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String name; + + /** + * The name of the quality gate to create + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java new file mode 100644 index 00000000000..cfff0bd19da --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a condition from a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteConditionRequest { + + private String id; + + /** + * Condition ID + * + * This is a mandatory parameter. + * Example value: "2" + */ + public DeleteConditionRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java new file mode 100644 index 00000000000..ee4cb906a62 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove the association of a project from a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeselectRequest { + + private String projectId; + private String projectKey; + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.1 + */ + @Deprecated + public DeselectRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public DeselectRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java new file mode 100644 index 00000000000..3550938bbe5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DestroyRequest { + + private String id; + + /** + * ID of the quality gate to delete + * + * This is a mandatory parameter. + * Example value: "1" + */ + public DestroyRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java new file mode 100644 index 00000000000..bdcfa5c0e19 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the quality gate of a project.
      Requires one of the following permissions:
      • 'Administer System'
      • 'Administer' rights on the specified project
      • 'Browse' on the specified project
      + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class GetByProjectRequest { + + private String project; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public GetByProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java new file mode 100644 index 00000000000..1b1bcdd2473 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the quality gate status of a project or a Compute Engine task.
      Either 'analysisId', 'projectId' or 'projectKey' must be provided
      The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.
      Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.
      Requires one of the following permissions:
      • 'Administer System'
      • 'Administer' rights on the specified project
      • 'Browse' on the specified project
      + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectStatusRequest { + + private String analysisId; + private String projectId; + private String projectKey; + + /** + * Analysis id + * + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public ProjectStatusRequest setAnalysisId(String analysisId) { + this.analysisId = analysisId; + return this; + } + + public String getAnalysisId() { + return analysisId; + } + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ProjectStatusRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public ProjectStatusRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java new file mode 100644 index 00000000000..f37cd94efee --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java @@ -0,0 +1,331 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.Qualitygates.AppWsResponse; +import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; +import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; +import org.sonarqube.ws.Qualitygates.UpdateConditionWsResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage quality gates, including conditions and project association. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class QualitygatesService extends BaseService { + + public QualitygatesService(WsConnector wsConnector) { + super(wsConnector, "api/qualitygates"); + } + + /** + * Get initialization items for the admin UI. For internal use + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public AppWsResponse app() { + return call( + new GetRequest(path("app")), + AppWsResponse.parser()); + } + + /** + * Copy a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void copy(CopyRequest request) { + call( + new PostRequest(path("copy")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("name", request.getName()), + CreateWsResponse.parser()); + } + + /** + * Add a new condition to a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public CreateConditionWsResponse createCondition(CreateConditionRequest request) { + return call( + new PostRequest(path("create_condition")) + .setParam("error", request.getError()) + .setParam("gateId", request.getGateId()) + .setParam("metric", request.getMetric()) + .setParam("op", request.getOp()) + .setParam("period", request.getPeriod()) + .setParam("warning", request.getWarning()), + CreateConditionWsResponse.parser()); + } + + /** + * Delete a condition from a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void deleteCondition(DeleteConditionRequest request) { + call( + new PostRequest(path("delete_condition")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the association of a project from a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void deselect(DeselectRequest request) { + call( + new PostRequest(path("deselect")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void destroy(DestroyRequest request) { + call( + new PostRequest(path("destroy")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the quality gate of a project.
      Requires one of the following permissions:
      • 'Administer System'
      • 'Administer' rights on the specified project
      • 'Browse' on the specified project
      + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public GetByProjectWsResponse getByProject(GetByProjectRequest request) { + return call( + new GetRequest(path("get_by_project")) + .setParam("project", request.getProject()), + GetByProjectWsResponse.parser()); + } + + /** + * Get a list of quality gates + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public String list() { + return call( + new GetRequest(path("list")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the quality gate status of a project or a Compute Engine task.
      Either 'analysisId', 'projectId' or 'projectKey' must be provided
      The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.
      Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.
      Requires one of the following permissions:
      • 'Administer System'
      • 'Administer' rights on the specified project
      • 'Browse' on the specified project
      + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ + public ProjectStatusWsResponse projectStatus(ProjectStatusRequest request) { + return call( + new GetRequest(path("project_status")) + .setParam("analysisId", request.getAnalysisId()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()), + ProjectStatusWsResponse.parser()); + } + + /** + * Rename a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for projects associated (or not) to a quality gate.
      Only authorized projects for current user will be returned. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("gateId", request.getGateId()) + .setParam("page", request.getPage()) + .setParam("pageSize", request.getPageSize()) + .setParam("query", request.getQuery()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Associate a project to a quality gate.
      The 'projectId' or 'projectKey' must be provided.
      Project id as a numeric value is deprecated since 6.1. Please use the id similar to 'AU-TpxcA-iU5OvuD2FLz'.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void select(SelectRequest request) { + call( + new PostRequest(path("select")) + .setParam("gateId", request.getGateId()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Set a quality gate as the default quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void setAsDefault(SetAsDefaultRequest request) { + call( + new PostRequest(path("set_as_default")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display the details of a quality gate + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public String show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Unset a quality gate as the default quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void unsetDefault(UnsetDefaultRequest request) { + call( + new PostRequest(path("unset_default")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a condition attached to a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void updateCondition(UpdateConditionRequest request) { + call( + new PostRequest(path("update_condition")) + .setParam("error", request.getError()) + .setParam("id", request.getId()) + .setParam("metric", request.getMetric()) + .setParam("op", request.getOp()) + .setParam("period", request.getPeriod()) + .setParam("warning", request.getWarning()), + UpdateConditionWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java new file mode 100644 index 00000000000..8d34ecac97e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Rename a Quality Gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RenameRequest { + + private String id; + private String name; + + /** + * ID of the quality gate to rename + * + * This is a mandatory parameter. + * Example value: "1" + */ + public RenameRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * New name of the quality gate + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java new file mode 100644 index 00000000000..0a89b6b64d7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for projects associated (or not) to a quality gate.
      Only authorized projects for current user will be returned. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String gateId; + private String page; + private String pageSize; + private String query; + private String selected; + + /** + * Quality Gate ID + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SearchRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Page number + * + * Example value: "2" + */ + public SearchRequest setPage(String page) { + this.page = page; + return this; + } + + public String getPage() { + return page; + } + + /** + * Page size + * + * Example value: "10" + */ + public SearchRequest setPageSize(String pageSize) { + this.pageSize = pageSize; + return this; + } + + public String getPageSize() { + return pageSize; + } + + /** + * To search for projects containing this string. If this parameter is set, "selected" is set to "all". + * + * Example value: "abc" + */ + public SearchRequest setQuery(String query) { + this.query = query; + return this; + } + + public String getQuery() { + return query; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
        + *
      • "all"
      • + *
      • "deselected"
      • + *
      • "selected"
      • + *
      + */ + public SearchRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java new file mode 100644 index 00000000000..be1fb81f108 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Associate a project to a quality gate.
      The 'projectId' or 'projectKey' must be provided.
      Project id as a numeric value is deprecated since 6.1. Please use the id similar to 'AU-TpxcA-iU5OvuD2FLz'.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SelectRequest { + + private String gateId; + private String projectId; + private String projectKey; + + /** + * Quality gate id + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SelectRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Project id. Project id as an numeric value is deprecated since 6.1 + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SelectRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SelectRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java new file mode 100644 index 00000000000..b71bfba7e40 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set a quality gate as the default quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetAsDefaultRequest { + + private String id; + + /** + * ID of the quality gate to set as default + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SetAsDefaultRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java new file mode 100644 index 00000000000..c14c39f0e69 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Display the details of a quality gate + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String id; + private String name; + + /** + * ID of the quality gate. Either id or name must be set + * + * Example value: "1" + */ + public ShowRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Name of the quality gate. Either id or name must be set + * + * Example value: "My Quality Gate" + */ + public ShowRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java new file mode 100644 index 00000000000..ab0e72e48a9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Unset a quality gate as the default quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UnsetDefaultRequest { + + private String id; + + /** + * ID of the quality gate to unset as default + * + * This is a mandatory parameter. + * Example value: "1" + */ + public UnsetDefaultRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java new file mode 100644 index 00000000000..96b49d8d3d1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java @@ -0,0 +1,138 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualitygates; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a condition attached to a quality gate.
      Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateConditionRequest { + + private String error; + private String id; + private String metric; + private String op; + private String period; + private String warning; + + /** + * Condition error threshold + * + * Example value: "10" + */ + public UpdateConditionRequest setError(String error) { + this.error = error; + return this; + } + + public String getError() { + return error; + } + + /** + * Condition ID + * + * This is a mandatory parameter. + * Example value: "10" + */ + public UpdateConditionRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Condition metric + * + * This is a mandatory parameter. + * Example value: "blocker_violations" + */ + public UpdateConditionRequest setMetric(String metric) { + this.metric = metric; + return this; + } + + public String getMetric() { + return metric; + } + + /** + * Condition operator:
      • EQ = equals
      • NE = is not
      • LT = is lower than
      • GT = is greater than
      • + * + * Example value: "EQ" + * Possible values: + *
          + *
        • "LT"
        • + *
        • "GT"
        • + *
        • "EQ"
        • + *
        • "NE"
        • + *
        + */ + public UpdateConditionRequest setOp(String op) { + this.op = op; + return this; + } + + public String getOp() { + return op; + } + + /** + * Condition period. If not set, the absolute value is considered. + * + * Possible values: + *
          + *
        • "1"
        • + *
        + */ + public UpdateConditionRequest setPeriod(String period) { + this.period = period; + return this; + } + + public String getPeriod() { + return period; + } + + /** + * Condition warning threshold + * + * Example value: "5" + */ + public UpdateConditionRequest setWarning(String warning) { + this.warning = warning; + return this; + } + + public String getWarning() { + return warning; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java new file mode 100644 index 00000000000..130a03c1334 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.qualitygates; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java new file mode 100644 index 00000000000..d4e48fa29f5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java @@ -0,0 +1,126 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Activate a rule on a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ActivateRuleRequest { + + private String key; + private String params; + private String reset; + private String rule; + private String severity; + + /** + * Quality Profile key. Can be obtained through api/qualityprofiles/search + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ActivateRuleRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Parameters as semi-colon list of key=value. Ignored if parameter reset is true. + * + * Example value: "params=key1=v1;key2=v2" + */ + public ActivateRuleRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ActivateRuleRequest setReset(String reset) { + this.reset = reset; + return this; + } + + public String getReset() { + return reset; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:AvoidCycles" + */ + public ActivateRuleRequest setRule(String rule) { + this.rule = rule; + return this; + } + + public String getRule() { + return rule; + } + + /** + * Severity. Ignored if parameter reset is true. + * + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public ActivateRuleRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java new file mode 100644 index 00000000000..3dfd8295a32 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java @@ -0,0 +1,421 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk-activate rules on one quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ActivateRulesRequest { + + private String activation; + private List activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List inheritance; + private String isTemplate; + private List languages; + private String organization; + private String q; + private String qprofile; + private List repositories; + private String ruleKey; + private String s; + private List severities; + private List statuses; + private List tags; + private String targetKey; + private String targetSeverity; + private String templateKey; + private List types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ActivateRulesRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public ActivateRulesRequest setActiveSeverities(List activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ActivateRulesRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public ActivateRulesRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public ActivateRulesRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + *
          + *
        • "NONE"
        • + *
        • "INHERITED"
        • + *
        • "OVERRIDES"
        • + *
        + */ + public ActivateRulesRequest setInheritance(List inheritance) { + this.inheritance = inheritance; + return this; + } + + public List getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ActivateRulesRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public ActivateRulesRequest setLanguages(List languages) { + this.languages = languages; + return this; + } + + public List getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ActivateRulesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public ActivateRulesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ActivateRulesRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public ActivateRulesRequest setRepositories(List repositories) { + this.repositories = repositories; + return this; + } + + public List getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public ActivateRulesRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + *
          + *
        • "name"
        • + *
        • "updatedAt"
        • + *
        • "createdAt"
        • + *
        • "key"
        • + *
        + */ + public ActivateRulesRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public ActivateRulesRequest setSeverities(List severities) { + this.severities = severities; + return this; + } + + public List getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + *
          + *
        • "BETA"
        • + *
        • "DEPRECATED"
        • + *
        • "READY"
        • + *
        • "REMOVED"
        • + *
        + */ + public ActivateRulesRequest setStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + public List getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public ActivateRulesRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } + + /** + * Quality Profile key on which the rule activation is done. To retrieve a quality profile key please see api/qualityprofiles/search + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivateRulesRequest setTargetKey(String targetKey) { + this.targetKey = targetKey; + return this; + } + + public String getTargetKey() { + return targetKey; + } + + /** + * Severity to set on the activated rules + * + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public ActivateRulesRequest setTargetSeverity(String targetSeverity) { + this.targetSeverity = targetSeverity; + return this; + } + + public String getTargetSeverity() { + return targetSeverity; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public ActivateRulesRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + *
          + *
        • "CODE_SMELL"
        • + *
        • "BUG"
        • + *
        • "VULNERABILITY"
        • + *
        + */ + public ActivateRulesRequest setTypes(List types) { + this.types = types; + return this; + } + + public List getTypes() { + return types; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java new file mode 100644 index 00000000000..6418e4d9fc7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Allow a group to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddGroupRequest { + + private String group; + private String language; + private String organization; + private String qualityProfile; + + /** + * Group name + * + * This is a mandatory parameter. + * Example value: "sonar-administrators" + */ + public AddGroupRequest setGroup(String group) { + this.group = group; + return this; + } + + public String getGroup() { + return group; + } + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public AddGroupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public AddGroupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java new file mode 100644 index 00000000000..17641c0d027 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java @@ -0,0 +1,130 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Associate a project with a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        • Administer right on the specified project
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddProjectRequest { + + private String key; + private String language; + private String organization; + private String project; + private String projectUuid; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public AddProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public AddProjectRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddProjectRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID. Either this parameter or 'project' must be set. + * + * Example value: "AU-TpxcA-iU5OvuD2FL5" + * @deprecated since 6.5 + */ + @Deprecated + public AddProjectRequest setProjectUuid(String projectUuid) { + this.projectUuid = projectUuid; + return this; + } + + public String getProjectUuid() { + return projectUuid; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public AddProjectRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java new file mode 100644 index 00000000000..4d8e684d5f1 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Allow a user to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddUserRequest { + + private String language; + private String login; + private String organization; + private String qualityProfile; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public AddUserRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "john.doe" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public AddUserRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java new file mode 100644 index 00000000000..d6cadd47bac --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class BackupRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public BackupRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public BackupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public BackupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public BackupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java new file mode 100644 index 00000000000..6d1385b354d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java @@ -0,0 +1,130 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Change a quality profile's parent.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ChangeParentRequest { + + private String key; + private String language; + private String organization; + private String parentKey; + private String parentQualityProfile; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ChangeParentRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public ChangeParentRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ChangeParentRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * New parent profile key.
        If no profile is provided, the inheritance link with current parent profile (if any) is broken, which deactivates all rules which come from the parent and are not overridden. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public ChangeParentRequest setParentKey(String parentKey) { + this.parentKey = parentKey; + return this; + } + + public String getParentKey() { + return parentKey; + } + + /** + * Quality profile name. If this parameter is set, 'parentKey' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangeParentRequest setParentQualityProfile(String parentQualityProfile) { + this.parentQualityProfile = parentQualityProfile; + return this; + } + + public String getParentQualityProfile() { + return parentQualityProfile; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangeParentRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java new file mode 100644 index 00000000000..2f4ab9ad257 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java @@ -0,0 +1,158 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first). + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ChangelogRequest { + + private String key; + private String language; + private String organization; + private String p; + private String ps; + private String qualityProfile; + private String since; + private String to; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ChangelogRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public ChangelogRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ChangelogRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ChangelogRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ChangelogRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangelogRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Start date for the changelog.
        Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ChangelogRequest setSince(String since) { + this.since = since; + return this; + } + + public String getSince() { + return since; + } + + /** + * End date for the changelog.
        Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ChangelogRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java new file mode 100644 index 00000000000..267fc4dd306 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Compare two quality profiles. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CompareRequest { + + private String leftKey; + private String rightKey; + + /** + * Profile key. + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CompareRequest setLeftKey(String leftKey) { + this.leftKey = leftKey; + return this; + } + + public String getLeftKey() { + return leftKey; + } + + /** + * Another profile key. + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public CompareRequest setRightKey(String rightKey) { + this.rightKey = rightKey; + return this; + } + + public String getRightKey() { + return rightKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java new file mode 100644 index 00000000000..e960b0f774d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Copy a quality profile.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CopyRequest { + + private String fromKey; + private String toName; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CopyRequest setFromKey(String fromKey) { + this.fromKey = fromKey; + return this; + } + + public String getFromKey() { + return fromKey; + } + + /** + * Name for the new quality profile. + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public CopyRequest setToName(String toName) { + this.toName = toName; + return this; + } + + public String getToName() { + return toName; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java new file mode 100644 index 00000000000..4e503bf14cf --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java @@ -0,0 +1,84 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a quality profile.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String language; + private String name; + private String organization; + + /** + * Quality profile language + * + * This is a mandatory parameter. + * Example value: "js" + */ + public CreateRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Quality profile name + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java new file mode 100644 index 00000000000..48ab5ef22b7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Deactivate a rule on a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeactivateRuleRequest { + + private String key; + private String rule; + + /** + * Quality Profile key. Can be obtained through api/qualityprofiles/search + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeactivateRuleRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:AvoidCycles" + */ + public DeactivateRuleRequest setRule(String rule) { + this.rule = rule; + return this; + } + + public String getRule() { + return rule; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java new file mode 100644 index 00000000000..df5d0d90277 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java @@ -0,0 +1,399 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk deactivate rules on Quality profiles.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeactivateRulesRequest { + + private String activation; + private List activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List inheritance; + private String isTemplate; + private List languages; + private String organization; + private String q; + private String qprofile; + private List repositories; + private String ruleKey; + private String s; + private List severities; + private List statuses; + private List tags; + private String targetKey; + private String templateKey; + private List types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public DeactivateRulesRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public DeactivateRulesRequest setActiveSeverities(List activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public DeactivateRulesRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public DeactivateRulesRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public DeactivateRulesRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + *
          + *
        • "NONE"
        • + *
        • "INHERITED"
        • + *
        • "OVERRIDES"
        • + *
        + */ + public DeactivateRulesRequest setInheritance(List inheritance) { + this.inheritance = inheritance; + return this; + } + + public List getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public DeactivateRulesRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public DeactivateRulesRequest setLanguages(List languages) { + this.languages = languages; + return this; + } + + public List getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeactivateRulesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public DeactivateRulesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeactivateRulesRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public DeactivateRulesRequest setRepositories(List repositories) { + this.repositories = repositories; + return this; + } + + public List getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public DeactivateRulesRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + *
          + *
        • "name"
        • + *
        • "updatedAt"
        • + *
        • "createdAt"
        • + *
        • "key"
        • + *
        + */ + public DeactivateRulesRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public DeactivateRulesRequest setSeverities(List severities) { + this.severities = severities; + return this; + } + + public List getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + *
          + *
        • "BETA"
        • + *
        • "DEPRECATED"
        • + *
        • "READY"
        • + *
        • "REMOVED"
        • + *
        + */ + public DeactivateRulesRequest setStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + public List getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public DeactivateRulesRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } + + /** + * Quality Profile key on which the rule deactivation is done. To retrieve a profile key please see api/qualityprofiles/search + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public DeactivateRulesRequest setTargetKey(String targetKey) { + this.targetKey = targetKey; + return this; + } + + public String getTargetKey() { + return targetKey; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public DeactivateRulesRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + *
          + *
        • "CODE_SMELL"
        • + *
        • "BUG"
        • + *
        • "VULNERABILITY"
        • + *
        + */ + public DeactivateRulesRequest setTypes(List types) { + this.types = types; + return this; + } + + public List getTypes() { + return types; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java new file mode 100644 index 00000000000..b387c1cca60 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a quality profile and all its descendants. The default quality profile cannot be deleted.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public DeleteRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public DeleteRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public DeleteRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java new file mode 100644 index 00000000000..6402b04da5f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Export a quality profile. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ExportRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ExportRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set. + * + * Example value: "" + */ + public ExportRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ExportRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name to export. If left empty, the default profile for the language is exported. If this parameter is set, 'key' must not be set. + * + * Example value: "My Sonar way" + */ + public ExportRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java new file mode 100644 index 00000000000..51161101417 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Show a quality profile's ancestors and children. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class InheritanceRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public InheritanceRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public InheritanceRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public InheritanceRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public InheritanceRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java new file mode 100644 index 00000000000..a1dfac3f3ef --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List projects with their association status regarding a quality profile + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ProjectsRequest { + + private String key; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ProjectsRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to projects that contain the supplied string. + * + * Example value: "sonar" + */ + public ProjectsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
          + *
        • "all"
        • + *
        • "deselected"
        • + *
        • "selected"
        • + *
        + */ + public ProjectsRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/QualityprofilesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/QualityprofilesService.java new file mode 100644 index 00000000000..b7a69005a3e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/QualityprofilesService.java @@ -0,0 +1,639 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Qualityprofiles.CopyWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; + +/** + * Manage quality profiles. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class QualityprofilesService extends BaseService { + + public QualityprofilesService(WsConnector wsConnector) { + super(wsConnector, "api/qualityprofiles"); + } + + /** + * Activate a rule on a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void activateRule(ActivateRuleRequest request) { + call( + new PostRequest(path("activate_rule")) + .setParam("key", request.getKey()) + .setParam("params", request.getParams()) + .setParam("reset", request.getReset()) + .setParam("rule", request.getRule()) + .setParam("severity", request.getSeverity()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk-activate rules on one quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void activateRules(ActivateRulesRequest request) { + call( + new PostRequest(path("activate_rules")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("targetKey", request.getTargetKey()) + .setParam("targetSeverity", request.getTargetSeverity()) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Allow a group to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public void addGroup(AddGroupRequest request) { + call( + new PostRequest(path("add_group")) + .setParam("group", request.getGroup()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Associate a project with a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        • Administer right on the specified project
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addProject(AddProjectRequest request) { + call( + new PostRequest(path("add_project")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("projectUuid", request.getProjectUuid()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Allow a user to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("language", request.getLanguage()) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String backup(BackupRequest request) { + return call( + new GetRequest(path("backup")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Change a quality profile's parent.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void changeParent(ChangeParentRequest request) { + call( + new PostRequest(path("change_parent")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("parentKey", request.getParentKey()) + .setParam("parentQualityProfile", request.getParentQualityProfile()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first). + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String changelog(ChangelogRequest request) { + return call( + new GetRequest(path("changelog")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("since", request.getSince()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Compare two quality profiles. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String compare(CompareRequest request) { + return call( + new GetRequest(path("compare")) + .setParam("leftKey", request.getLeftKey()) + .setParam("rightKey", request.getRightKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Copy a quality profile.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void copy(CopyRequest request) { + call( + new PostRequest(path("copy")) + .setParam("fromKey", request.getFromKey()) + .setParam("toName", request.getToName()), + CopyWsResponse.parser()); + } + + /** + * Create a quality profile.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("language", request.getLanguage()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()), + CreateWsResponse.parser()); + } + + /** + * Deactivate a rule on a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void deactivateRule(DeactivateRuleRequest request) { + call( + new PostRequest(path("deactivate_rule")) + .setParam("key", request.getKey()) + .setParam("rule", request.getRule()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk deactivate rules on Quality profiles.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void deactivateRules(DeactivateRulesRequest request) { + call( + new PostRequest(path("deactivate_rules")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("targetKey", request.getTargetKey()) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a quality profile and all its descendants. The default quality profile cannot be deleted.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Export a quality profile. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String export(ExportRequest request) { + return call( + new GetRequest(path("export")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists available profile export formats. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String exporters() { + return call( + new GetRequest(path("exporters")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List supported importers. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String importers() { + return call( + new GetRequest(path("importers")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show a quality profile's ancestors and children. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public InheritanceWsResponse inheritance(InheritanceRequest request) { + return call( + new GetRequest(path("inheritance")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()), + InheritanceWsResponse.parser()); + } + + /** + * List projects with their association status regarding a quality profile + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String projects(ProjectsRequest request) { + return call( + new GetRequest(path("projects")) + .setParam("key", request.getKey()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the ability from a group to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public void removeGroup(RemoveGroupRequest request) { + call( + new PostRequest(path("remove_group")) + .setParam("group", request.getGroup()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a project's association with a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        • Administer right on the specified project
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeProject(RemoveProjectRequest request) { + call( + new PostRequest(path("remove_project")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("projectUuid", request.getProjectUuid()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the ability from a user to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("language", request.getLanguage()) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Rename a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Restore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void restore(RestoreRequest request) { + call( + new PostRequest(path("restore")) + .setParam("backup", request.getBackup()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * This web service has no effect since 6.4. It's no more possible to restore built-in quality profiles because they are automatically updated and read only. Returns HTTP code 410. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + * @deprecated since 6.4 + */ + @Deprecated + public void restoreBuiltIn() { + call( + new PostRequest(path("restore_built_in")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search quality profiles + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("defaults", request.getDefaults()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("qualityProfile", request.getQualityProfile()), + SearchWsResponse.parser()); + } + + /** + * List the groups that are allowed to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public SearchGroupsResponse searchGroups(SearchGroupsRequest request) { + return call( + new GetRequest(path("search_groups")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("selected", request.getSelected()), + SearchGroupsResponse.parser()); + } + + /** + * List the users that are allowed to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public SearchUsersResponse searchUsers(SearchUsersRequest request) { + return call( + new GetRequest(path("search_users")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("selected", request.getSelected()), + SearchUsersResponse.parser()); + } + + /** + * Select the default profile for a given language.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void setDefault(SetDefaultRequest request) { + call( + new PostRequest(path("set_default")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show a quality profile + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.5 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("compareToSonarWay", request.getCompareToSonarWay()) + .setParam("key", request.getKey()), + ShowResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java new file mode 100644 index 00000000000..1ce019a02d6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove the ability from a group to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveGroupRequest { + + private String group; + private String language; + private String organization; + private String qualityProfile; + + /** + * Group name + * + * This is a mandatory parameter. + * Example value: "sonar-administrators" + */ + public RemoveGroupRequest setGroup(String group) { + this.group = group; + return this; + } + + public String getGroup() { + return group; + } + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public RemoveGroupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public RemoveGroupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java new file mode 100644 index 00000000000..33e13a8d504 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java @@ -0,0 +1,130 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a project's association with a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        • Administer right on the specified project
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveProjectRequest { + + private String key; + private String language; + private String organization; + private String project; + private String projectUuid; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public RemoveProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public RemoveProjectRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveProjectRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID. Either this parameter, or 'project' must be set. + * + * Example value: "AU-TpxcB-iU5OvuD2FL6" + * @deprecated since 6.5 + */ + @Deprecated + public RemoveProjectRequest setProjectUuid(String projectUuid) { + this.projectUuid = projectUuid; + return this; + } + + public String getProjectUuid() { + return projectUuid; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public RemoveProjectRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java new file mode 100644 index 00000000000..4ac207fb8bb --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove the ability from a user to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveUserRequest { + + private String language; + private String login; + private String organization; + private String qualityProfile; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public RemoveUserRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "john.doe" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public RemoveUserRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java new file mode 100644 index 00000000000..089a27b8341 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Rename a quality profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RenameRequest { + + private String key; + private String name; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RenameRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * New quality profile name + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java new file mode 100644 index 00000000000..881af40a801 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Restore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RestoreRequest { + + private String backup; + private String organization; + + /** + * A profile backup file in XML format, as generated by api/qualityprofiles/backup or the former api/profiles/backup. + * + * This is a mandatory parameter. + */ + public RestoreRequest setBackup(String backup) { + this.backup = backup; + return this; + } + + public String getBackup() { + return backup; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RestoreRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java new file mode 100644 index 00000000000..ad4be2f9f96 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java @@ -0,0 +1,148 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List the groups that are allowed to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchGroupsRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private String qualityProfile; + private String selected; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public SearchGroupsRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchGroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchGroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchGroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. + * + * Example value: "sonar" + */ + public SearchGroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public SearchGroupsRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
          + *
        • "all"
        • + *
        • "deselected"
        • + *
        • "selected"
        • + *
        + */ + public SearchGroupsRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java new file mode 100644 index 00000000000..08d26217f66 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search quality profiles + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String defaults; + private String language; + private String organization; + private String project; + private String qualityProfile; + + /** + * If set to true, return only the quality profiles marked as default for each language + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public SearchRequest setDefaults(String defaults) { + this.defaults = defaults; + return this; + } + + public String getDefaults() { + return defaults; + } + + /** + * Language key. If provided, only profiles for the given language are returned. + * + */ + public SearchRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Quality profile name + * + * Example value: "SonarQube Way" + */ + public SearchRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java new file mode 100644 index 00000000000..ed8748955c5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java @@ -0,0 +1,148 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List the users that are allowed to edit a Quality Profile.
        Requires one of the following permissions:
        • 'Administer Quality Profiles'
        • Edit right on the specified quality profile
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchUsersRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private String qualityProfile; + private String selected; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public SearchUsersRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchUsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchUsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchUsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "freddy" + */ + public SearchUsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public SearchUsersRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
          + *
        • "all"
        • + *
        • "deselected"
        • + *
        • "selected"
        • + *
        + */ + public SearchUsersRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java new file mode 100644 index 00000000000..66f1d5773ec --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Select the default profile for a given language.
        Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetDefaultRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public SetDefaultRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public SetDefaultRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SetDefaultRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public SetDefaultRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java new file mode 100644 index 00000000000..68e84c47b28 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Show a quality profile + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String compareToSonarWay; + private String key; + + /** + * Add the number of missing rules from the related Sonar way profile in the response + * + * This is part of the internal API. + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ShowRequest setCompareToSonarWay(String compareToSonarWay) { + this.compareToSonarWay = compareToSonarWay; + return this; + } + + public String getCompareToSonarWay() { + return compareToSonarWay; + } + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java new file mode 100644 index 00000000000..a86e3fbe31e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.qualityprofiles; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java new file mode 100644 index 00000000000..26910166be4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.resources; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/components and api/measures instead + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ResourcesService extends BaseService { + + public ResourcesService(WsConnector wsConnector) { + super(wsConnector, "api/resources"); + } + + /** + * The web service is removed and you're invited to use the alternatives:
        • if you need one component without measures: api/components/show
        • if you need one component with measures: api/measures/component
        • if you need several components without measures: api/components/tree
        • if you need several components with measures: api/measures/component_tree
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.10 + * @deprecated since 5.4 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/package-info.java new file mode 100644 index 00000000000..4d0c676f441 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/resources/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.resources; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/RootsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/RootsService.java new file mode 100644 index 00000000000..a1dc93f98f7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/RootsService.java @@ -0,0 +1,87 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage root users + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RootsService extends BaseService { + + public RootsService(WsConnector wsConnector) { + super(wsConnector, "api/roots"); + } + + /** + * Search for root users.
        Requires to be root. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public String search() { + return call( + new GetRequest(path("search")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Make the specified user root.
        Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public void setRoot(SetRootRequest request) { + call( + new PostRequest(path("set_root")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Make the specified user not root.
        Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public void unsetRoot(UnsetRootRequest request) { + call( + new PostRequest(path("unset_root")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java new file mode 100644 index 00000000000..1daa9a50ed5 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Make the specified user root.
        Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetRootRequest { + + private String login; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public SetRootRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java new file mode 100644 index 00000000000..861c6a88c21 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Make the specified user not root.
        Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UnsetRootRequest { + + private String login; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public UnsetRootRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/package-info.java new file mode 100644 index 00000000000..58675691a02 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/roots/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.roots; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java new file mode 100644 index 00000000000..7123eb6029c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get data required for rendering the page 'Coding Rules'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AppRequest { + + private String organization; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AppRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java new file mode 100644 index 00000000000..8b8a1236cea --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java @@ -0,0 +1,214 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a custom rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String customKey; + private String manualKey; + private String markdownDescription; + private String name; + private String params; + private String preventReactivation; + private String severity; + private String status; + private String templateKey; + private String type; + + /** + * Key of the custom rule + * + * This is a mandatory parameter. + * Example value: "Todo_should_not_be_used" + */ + public CreateRequest setCustomKey(String customKey) { + this.customKey = customKey; + return this; + } + + public String getCustomKey() { + return customKey; + } + + /** + * Manual rules are no more supported. This parameter is ignored + * + * Example value: "Error_handling" + * @deprecated since 5.5 + */ + @Deprecated + public CreateRequest setManualKey(String manualKey) { + this.manualKey = manualKey; + return this; + } + + public String getManualKey() { + return manualKey; + } + + /** + * Rule description + * + * This is a mandatory parameter. + * Example value: "Description of my custom rule" + */ + public CreateRequest setMarkdownDescription(String markdownDescription) { + this.markdownDescription = markdownDescription; + return this; + } + + public String getMarkdownDescription() { + return markdownDescription; + } + + /** + * Rule name + * + * This is a mandatory parameter. + * Example value: "My custom rule" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) + * + */ + public CreateRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public CreateRequest setPreventReactivation(String preventReactivation) { + this.preventReactivation = preventReactivation; + return this; + } + + public String getPreventReactivation() { + return preventReactivation; + } + + /** + * Rule severity + * + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public CreateRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } + + /** + * Rule status + * + * Possible values: + *
          + *
        • "BETA"
        • + *
        • "DEPRECATED"
        • + *
        • "READY"
        • + *
        • "REMOVED"
        • + *
        + */ + public CreateRequest setStatus(String status) { + this.status = status; + return this; + } + + public String getStatus() { + return status; + } + + /** + * Key of the template rule in order to create a custom rule (mandatory for custom rule) + * + * Example value: "java:XPath" + */ + public CreateRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Rule type + * + * Possible values: + *
          + *
        • "CODE_SMELL"
        • + *
        • "BUG"
        • + *
        • "VULNERABILITY"
        • + *
        + */ + public CreateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java new file mode 100644 index 00000000000..b40e4d89aa9 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete custom rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String key; + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:XPath_1402065390816" + */ + public DeleteRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java new file mode 100644 index 00000000000..bcdf91d44cb --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List available rule repositories + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RepositoriesRequest { + + private String language; + private String q; + + /** + * A language key; if provided, only repositories for the given language will be returned + * + * Example value: "java" + */ + public RepositoriesRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * A pattern to match repository keys/names against + * + * Example value: "squid" + */ + public RepositoriesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RulesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RulesService.java new file mode 100644 index 00000000000..128eedfcc5a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/RulesService.java @@ -0,0 +1,234 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Rules.CreateResponse; +import org.sonarqube.ws.Rules.ListResponse; +import org.sonarqube.ws.Rules.SearchResponse; +import org.sonarqube.ws.Rules.ShowResponse; +import org.sonarqube.ws.Rules.UpdateResponse; + +/** + * Get and update some details of automatic rules, and manage custom rules. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RulesService extends BaseService { + + public RulesService(WsConnector wsConnector) { + super(wsConnector, "api/rules"); + } + + /** + * Get data required for rendering the page 'Coding Rules'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ + public String app(AppRequest request) { + return call( + new GetRequest(path("app")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a custom rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("custom_key", request.getCustomKey()) + .setParam("manual_key", request.getManualKey()) + .setParam("markdown_description", request.getMarkdownDescription()) + .setParam("name", request.getName()) + .setParam("params", request.getParams()) + .setParam("prevent_reactivation", request.getPreventReactivation()) + .setParam("severity", request.getSeverity()) + .setParam("status", request.getStatus()) + .setParam("template_key", request.getTemplateKey()) + .setParam("type", request.getType()), + CreateResponse.parser()); + } + + /** + * Delete custom rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List rules, excluding the manual rules and the rules with status REMOVED. JSON format is not supported for response. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public ListResponse list() { + return call( + new GetRequest(path("list")), + ListResponse.parser()); + } + + /** + * List available rule repositories + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.5 + */ + public String repositories(RepositoriesRequest request) { + return call( + new GetRequest(path("repositories")) + .setParam("language", request.getLanguage()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for a collection of relevant rules matching a specified query.
        Since 5.5, following fields in the response have been deprecated :
        • "effortToFixDescription" becomes "gapDescription"
        • "debtRemFnCoeff" becomes "remFnGapMultiplier"
        • "defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"
        • "debtRemFnOffset" becomes "remFnBaseEffort"
        • "defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"
        • "debtOverloaded" becomes "remFnOverloaded"
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))), + SearchResponse.parser()); + } + + /** + * Get detailed information about a rule
        Since 5.5, following fields in the response have been deprecated :
        • "effortToFixDescription" becomes "gapDescription"
        • "debtRemFnCoeff" becomes "remFnGapMultiplier"
        • "defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"
        • "debtRemFnOffset" becomes "remFnBaseEffort"
        • "defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"
        • "debtOverloaded" becomes "remFnOverloaded"
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("actives", request.getActives()) + .setParam("key", request.getKey()) + .setParam("organization", request.getOrganization()), + ShowResponse.parser()); + } + + /** + * List rule tags + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String tags(TagsRequest request) { + return call( + new GetRequest(path("tags")) + .setParam("organization", request.getOrganization()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update an existing rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("debt_remediation_fn_offset", request.getDebtRemediationFnOffset()) + .setParam("debt_remediation_fn_type", request.getDebtRemediationFnType()) + .setParam("debt_remediation_fy_coeff", request.getDebtRemediationFyCoeff()) + .setParam("debt_sub_characteristic", request.getDebtSubCharacteristic()) + .setParam("key", request.getKey()) + .setParam("markdown_description", request.getMarkdownDescription()) + .setParam("markdown_note", request.getMarkdownNote()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("params", request.getParams()) + .setParam("remediation_fn_base_effort", request.getRemediationFnBaseEffort()) + .setParam("remediation_fn_type", request.getRemediationFnType()) + .setParam("remediation_fy_gap_multiplier", request.getRemediationFyGapMultiplier()) + .setParam("severity", request.getSeverity()) + .setParam("status", request.getStatus()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))), + UpdateResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java new file mode 100644 index 00000000000..c732e6fdf5d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java @@ -0,0 +1,484 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for a collection of relevant rules matching a specified query.
        Since 5.5, following fields in the response have been deprecated :
        • "effortToFixDescription" becomes "gapDescription"
        • "debtRemFnCoeff" becomes "remFnGapMultiplier"
        • "defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"
        • "debtRemFnOffset" becomes "remFnBaseEffort"
        • "defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"
        • "debtOverloaded" becomes "remFnOverloaded"
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String activation; + private List activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List f; + private List facets; + private List inheritance; + private String isTemplate; + private List languages; + private String organization; + private String p; + private String ps; + private String q; + private String qprofile; + private List repositories; + private String ruleKey; + private String s; + private List severities; + private List statuses; + private List tags; + private String templateKey; + private List types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public SearchRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public SearchRequest setActiveSeverities(List activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public SearchRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public SearchRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public SearchRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default, except actives.Since 5.5, following fields have been deprecated :
        • "defaultDebtRemFn" becomes "defaultRemFn"
        • "debtRemFn" becomes "remFn"
        • "effortToFixDescription" becomes "gapDescription"
        • "debtOverloaded" becomes "remFnOverloaded"
        + * + * Example value: "repo,name" + * Possible values: + *
          + *
        • "actives"
        • + *
        • "createdAt"
        • + *
        • "debtOverloaded"
        • + *
        • "debtRemFn"
        • + *
        • "defaultDebtRemFn"
        • + *
        • "defaultRemFn"
        • + *
        • "effortToFixDescription"
        • + *
        • "gapDescription"
        • + *
        • "htmlDesc"
        • + *
        • "htmlNote"
        • + *
        • "internalKey"
        • + *
        • "isTemplate"
        • + *
        • "lang"
        • + *
        • "langName"
        • + *
        • "mdDesc"
        • + *
        • "mdNote"
        • + *
        • "name"
        • + *
        • "noteLogin"
        • + *
        • "params"
        • + *
        • "remFn"
        • + *
        • "remFnOverloaded"
        • + *
        • "repo"
        • + *
        • "severity"
        • + *
        • "status"
        • + *
        • "sysTags"
        • + *
        • "tags"
        • + *
        • "templateKey"
        • + *
        + */ + public SearchRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default. + * + * Example value: "languages,repositories" + * Possible values: + *
          + *
        • "languages"
        • + *
        • "repositories"
        • + *
        • "tags"
        • + *
        • "severities"
        • + *
        • "active_severities"
        • + *
        • "statuses"
        • + *
        • "types"
        • + *
        • "true"
        • + *
        + */ + public SearchRequest setFacets(List facets) { + this.facets = facets; + return this; + } + + public List getFacets() { + return facets; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + *
          + *
        • "NONE"
        • + *
        • "INHERITED"
        • + *
        • "OVERRIDES"
        • + *
        + */ + public SearchRequest setInheritance(List inheritance) { + this.inheritance = inheritance; + return this; + } + + public List getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public SearchRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public SearchRequest setLanguages(List languages) { + this.languages = languages; + return this; + } + + public List getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SearchRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public SearchRequest setRepositories(List repositories) { + this.repositories = repositories; + return this; + } + + public List getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public SearchRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + *
          + *
        • "name"
        • + *
        • "updatedAt"
        • + *
        • "createdAt"
        • + *
        • "key"
        • + *
        + */ + public SearchRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public SearchRequest setSeverities(List severities) { + this.severities = severities; + return this; + } + + public List getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + *
          + *
        • "BETA"
        • + *
        • "DEPRECATED"
        • + *
        • "READY"
        • + *
        • "REMOVED"
        • + *
        + */ + public SearchRequest setStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + public List getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public SearchRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public SearchRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + *
          + *
        • "CODE_SMELL"
        • + *
        • "BUG"
        • + *
        • "VULNERABILITY"
        • + *
        + */ + public SearchRequest setTypes(List types) { + this.types = types; + return this; + } + + public List getTypes() { + return types; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java new file mode 100644 index 00000000000..253f0578d4e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java @@ -0,0 +1,89 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get detailed information about a rule
        Since 5.5, following fields in the response have been deprecated :
        • "effortToFixDescription" becomes "gapDescription"
        • "debtRemFnCoeff" becomes "remFnGapMultiplier"
        • "defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"
        • "debtRemFnOffset" becomes "remFnBaseEffort"
        • "defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"
        • "debtOverloaded" becomes "remFnOverloaded"
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String actives; + private String key; + private String organization; + + /** + * Show rule's activations for all profiles ("active rules") + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ShowRequest setActives(String actives) { + this.actives = actives; + return this; + } + + public String getActives() { + return actives; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "javascript:EmptyBlock" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ShowRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java new file mode 100644 index 00000000000..cc1c6a3e558 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List rule tags + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TagsRequest { + + private String organization; + private String ps; + private String q; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TagsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "misra" + */ + public TagsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java new file mode 100644 index 00000000000..a692cb22d85 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java @@ -0,0 +1,299 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update an existing rule.
        Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String debtRemediationFnOffset; + private String debtRemediationFnType; + private String debtRemediationFyCoeff; + private String debtSubCharacteristic; + private String key; + private String markdownDescription; + private String markdownNote; + private String name; + private String organization; + private String params; + private String remediationFnBaseEffort; + private String remediationFnType; + private String remediationFyGapMultiplier; + private String severity; + private String status; + private List tags; + + /** + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFnOffset(String debtRemediationFnOffset) { + this.debtRemediationFnOffset = debtRemediationFnOffset; + return this; + } + + public String getDebtRemediationFnOffset() { + return debtRemediationFnOffset; + } + + /** + * Possible values: + *
          + *
        • "LINEAR"
        • + *
        • "LINEAR_OFFSET"
        • + *
        • "CONSTANT_ISSUE"
        • + *
        + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFnType(String debtRemediationFnType) { + this.debtRemediationFnType = debtRemediationFnType; + return this; + } + + public String getDebtRemediationFnType() { + return debtRemediationFnType; + } + + /** + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFyCoeff(String debtRemediationFyCoeff) { + this.debtRemediationFyCoeff = debtRemediationFyCoeff; + return this; + } + + public String getDebtRemediationFyCoeff() { + return debtRemediationFyCoeff; + } + + /** + * Debt characteristics are no more supported. This parameter is ignored. + * + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtSubCharacteristic(String debtSubCharacteristic) { + this.debtSubCharacteristic = debtSubCharacteristic; + return this; + } + + public String getDebtSubCharacteristic() { + return debtSubCharacteristic; + } + + /** + * Key of the rule to update + * + * This is a mandatory parameter. + * Example value: "javascript:NullCheck" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Rule description (mandatory for custom rule and manual rule) + * + * Example value: "Description of my custom rule" + */ + public UpdateRequest setMarkdownDescription(String markdownDescription) { + this.markdownDescription = markdownDescription; + return this; + } + + public String getMarkdownDescription() { + return markdownDescription; + } + + /** + * Optional note in markdown format. Use empty value to remove current note. Note is not changedif the parameter is not set. + * + * Example value: "my *note*" + */ + public UpdateRequest setMarkdownNote(String markdownNote) { + this.markdownNote = markdownNote; + return this; + } + + public String getMarkdownNote() { + return markdownNote; + } + + /** + * Rule name (mandatory for custom rule) + * + * Example value: "My custom rule" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UpdateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only when updating a custom rule) + * + */ + public UpdateRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * Base effort of the remediation function of the rule + * + * Example value: "1d" + */ + public UpdateRequest setRemediationFnBaseEffort(String remediationFnBaseEffort) { + this.remediationFnBaseEffort = remediationFnBaseEffort; + return this; + } + + public String getRemediationFnBaseEffort() { + return remediationFnBaseEffort; + } + + /** + * Type of the remediation function of the rule + * + * Possible values: + *
          + *
        • "LINEAR"
        • + *
        • "LINEAR_OFFSET"
        • + *
        • "CONSTANT_ISSUE"
        • + *
        + */ + public UpdateRequest setRemediationFnType(String remediationFnType) { + this.remediationFnType = remediationFnType; + return this; + } + + public String getRemediationFnType() { + return remediationFnType; + } + + /** + * Gap multiplier of the remediation function of the rule + * + * Example value: "3min" + */ + public UpdateRequest setRemediationFyGapMultiplier(String remediationFyGapMultiplier) { + this.remediationFyGapMultiplier = remediationFyGapMultiplier; + return this; + } + + public String getRemediationFyGapMultiplier() { + return remediationFyGapMultiplier; + } + + /** + * Rule severity (Only when updating a custom rule) + * + * Possible values: + *
          + *
        • "INFO"
        • + *
        • "MINOR"
        • + *
        • "MAJOR"
        • + *
        • "CRITICAL"
        • + *
        • "BLOCKER"
        • + *
        + */ + public UpdateRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } + + /** + * Rule status (Only when updating a custom rule) + * + * Possible values: + *
          + *
        • "BETA"
        • + *
        • "DEPRECATED"
        • + *
        • "READY"
        • + *
        • "REMOVED"
        • + *
        + */ + public UpdateRequest setStatus(String status) { + this.status = status; + return this; + } + + public String getStatus() { + return status; + } + + /** + * Optional comma-separated list of tags to set. Use blank value to remove current tags. Tags are not changed if the parameter is not set. + * + * Example value: "java8,security" + */ + public UpdateRequest setTags(List tags) { + this.tags = tags; + return this; + } + + public List getTags() { + return tags; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/package-info.java new file mode 100644 index 00000000000..350942a959c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/rules/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.rules; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/ServerService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/ServerService.java new file mode 100644 index 00000000000..d55ddd814a8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/ServerService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.server; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * $webService.description.asString + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ServerService extends BaseService { + + public ServerService(WsConnector wsConnector) { + super(wsConnector, "api/server"); + } + + /** + * Version of SonarQube in plain text + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.10 + */ + public String version() { + return call( + new GetRequest(path("version")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/package-info.java new file mode 100644 index 00000000000..8e64aaefb0f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/server/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.server; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java new file mode 100644 index 00000000000..331912b5d4c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Encrypt a setting value.
        Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class EncryptRequest { + + private String value; + + /** + * Setting value to encrypt + * + * This is a mandatory parameter. + * Example value: "my value" + */ + public EncryptRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java new file mode 100644 index 00000000000..e804a256d30 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List settings definitions.
        Requires 'Browse' permission when a component is specified
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListDefinitionsRequest { + + private String branch; + private String component; + + /** + * Branch key. Only available on following settings : sonar.leak.period + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ListDefinitionsRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ListDefinitionsRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java new file mode 100644 index 00000000000..23b59784601 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a setting value.
        Requires one of the following permissions:
        • 'Administer System'
        • 'Administer' rights on the specified component
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ResetRequest { + + private String branch; + private String component; + private String keys; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ResetRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ResetRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Setting keys + * + * This is a mandatory parameter. + * Example value: "sonar.links.scm,sonar.debt.hoursInDay" + */ + public ResetRequest setKeys(String keys) { + this.keys = keys; + return this; + } + + public String getKeys() { + return keys; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java new file mode 100644 index 00000000000..4e5fd1478c4 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a setting value.
        Either 'value' or 'values' must be provided.
        Requires one of the following permissions:
        • 'Administer System'
        • 'Administer' rights on the specified component
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SetRequest { + + private String branch; + private String component; + private String fieldValues; + private String key; + private String value; + private String values; + + /** + * Branch key. Only available on following settings : sonar.leak.period + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SetRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public SetRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Setting field values. To set several values, the parameter must be called once for each value. + * + * Example value: "fieldValues={\"firstField\":\"first value\", \"secondField\":\"second value\", \"thirdField\":\"third value\"}" + */ + public SetRequest setFieldValues(String fieldValues) { + this.fieldValues = fieldValues; + return this; + } + + public String getFieldValues() { + return fieldValues; + } + + /** + * Setting key + * + * This is a mandatory parameter. + * Example value: "sonar.links.scm" + */ + public SetRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Setting value. To reset a value, please use the reset web service. + * + * Example value: "git@github.com:SonarSource/sonarqube.git" + */ + public SetRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } + + /** + * Setting multi value. To set several values, the parameter must be called once for each value. + * + * Example value: "values=firstValue&values=secondValue&values=thirdValue" + */ + public SetRequest setValues(String values) { + this.values = values; + return this; + } + + public String getValues() { + return values; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java new file mode 100644 index 00000000000..a060004e526 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java @@ -0,0 +1,160 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Settings.CheckSecretKeyWsResponse; +import org.sonarqube.ws.Settings.EncryptWsResponse; +import org.sonarqube.ws.Settings.GenerateSecretKeyWsResponse; +import org.sonarqube.ws.Settings.ListDefinitionsWsResponse; +import org.sonarqube.ws.Settings.ValuesWsResponse; + +/** + * Manage settings. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SettingsService extends BaseService { + + public SettingsService(WsConnector wsConnector) { + super(wsConnector, "api/settings"); + } + + /** + * Check if a secret key is available.
        Requires the 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public CheckSecretKeyWsResponse checkSecretKey() { + return call( + new GetRequest(path("check_secret_key")), + CheckSecretKeyWsResponse.parser()); + } + + /** + * Encrypt a setting value.
        Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public EncryptWsResponse encrypt(EncryptRequest request) { + return call( + new GetRequest(path("encrypt")) + .setParam("value", request.getValue()), + EncryptWsResponse.parser()); + } + + /** + * Generate a secret key.
        Requires the 'Administer System' permission + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public GenerateSecretKeyWsResponse generateSecretKey() { + return call( + new GetRequest(path("generate_secret_key")), + GenerateSecretKeyWsResponse.parser()); + } + + /** + * List settings definitions.
        Requires 'Browse' permission when a component is specified
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public ListDefinitionsWsResponse listDefinitions(ListDefinitionsRequest request) { + return call( + new GetRequest(path("list_definitions")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()), + ListDefinitionsWsResponse.parser()); + } + + /** + * Remove a setting value.
        Requires one of the following permissions:
        • 'Administer System'
        • 'Administer' rights on the specified component
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public void reset(ResetRequest request) { + call( + new PostRequest(path("reset")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("keys", request.getKeys()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a setting value.
        Either 'value' or 'values' must be provided.
        Requires one of the following permissions:
        • 'Administer System'
        • 'Administer' rights on the specified component
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.1 + */ + public void set(SetRequest request) { + call( + new PostRequest(path("set")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("fieldValues", request.getFieldValues()) + .setParam("key", request.getKey()) + .setParam("value", request.getValue()) + .setParam("values", request.getValues()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List settings values.
        If no value has been set for a setting, then the default value is returned.
        Requires 'Browse' permission when a component is specified
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public ValuesWsResponse values(ValuesRequest request) { + return call( + new GetRequest(path("values")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("keys", request.getKeys()), + ValuesWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java new file mode 100644 index 00000000000..db511b00ddc --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List settings values.
        If no value has been set for a setting, then the default value is returned.
        Requires 'Browse' permission when a component is specified
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ValuesRequest { + + private String branch; + private String component; + private String keys; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ValuesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ValuesRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * List of setting keys + * + * Example value: "sonar.test.inclusions,sonar.dbcleaner.cleanDirectory" + */ + public ValuesRequest setKeys(String keys) { + this.keys = keys; + return this; + } + + public String getKeys() { + return keys; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/package-info.java new file mode 100644 index 00000000000..09aad91956c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.settings; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java new file mode 100644 index 00000000000..d73a89558f0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Show line line hashes for a given file. Require See Source Code permission on file's project
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class HashRequest { + + private String key; + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public HashRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java new file mode 100644 index 00000000000..2646a54f935 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java @@ -0,0 +1,80 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get source code as line number / text pairs. Require See Source Code permission on file + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class IndexRequest { + + private String from; + private String resource; + private String to; + + /** + * First line + * + */ + public IndexRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public IndexRequest setResource(String resource) { + this.resource = resource; + return this; + } + + public String getResource() { + return resource; + } + + /** + * Last line (excluded). If not specified, all lines are returned until end of file + * + */ + public IndexRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java new file mode 100644 index 00000000000..f2c9000592b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Show source code with line oriented info. Require See Source Code permission on file's project
        Each element of the result array is an object which contains:
        1. Line number
        2. Content of the line
        3. Author of the line (from SCM information)
        4. Revision of the line (from SCM information)
        5. Last commit date of the line (from SCM information)
        6. Line hits from coverage
        7. Number of conditions to cover in tests
        8. Number of conditions covered by tests
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class LinesRequest { + + private String branch; + private String from; + private String key; + private String to; + private String uuid; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public LinesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * First line to return. Starts from 1 + * + * Example value: "10" + */ + public LinesRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key. Mandatory if param 'uuid' is not set. Available since 5.2 + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public LinesRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Optional last line to return (inclusive). It must be greater than or equal to parameter 'from'. If unset, then all the lines greater than or equal to 'from' are returned. + * + * Example value: "20" + */ + public LinesRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } + + /** + * File uuid. Mandatory if param 'key' is not set + * + * Example value: "f333aab4-7e3a-4d70-87e1-f4c491f05e5c" + */ + public LinesRequest setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getUuid() { + return uuid; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java new file mode 100644 index 00000000000..825bcc27635 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get source code as raw text. Require 'See Source Code' permission on file + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RawRequest { + + private String branch; + private String key; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public RawRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:src/foo/Bar.php" + */ + public RawRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java new file mode 100644 index 00000000000..587bc13bb08 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java @@ -0,0 +1,103 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get SCM information of source files. Require See Source Code permission on file's project
        Each element of the result array is composed of:
        1. Line number
        2. Author of the commit
        3. Datetime of the commit (before 5.2 it was only the Date)
        4. Revision of the commit (added in 5.2)
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ScmRequest { + + private String commitsByLine; + private String from; + private String key; + private String to; + + /** + * Group lines by SCM commit if value is false, else display commits for each line, even if two consecutive lines relate to the same commit. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ScmRequest setCommitsByLine(String commitsByLine) { + this.commitsByLine = commitsByLine; + return this; + } + + public String getCommitsByLine() { + return commitsByLine; + } + + /** + * First line to return. Starts at 1 + * + * Example value: "10" + */ + public ScmRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public ScmRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Last line to return (inclusive) + * + * Example value: "20" + */ + public ScmRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java new file mode 100644 index 00000000000..8d8b53303dd --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get source code. Require See Source Code permission on file's project
        Each element of the result array is composed of:
        1. Line number
        2. Content of the line
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ShowRequest { + + private String from; + private String key; + private String to; + + /** + * First line to return. Starts at 1 + * + * Example value: "10" + */ + public ShowRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Last line to return (inclusive) + * + * Example value: "20" + */ + public ShowRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java new file mode 100644 index 00000000000..3dcaadc0ed6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java @@ -0,0 +1,148 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get details on source files. See also api/tests. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SourcesService extends BaseService { + + public SourcesService(WsConnector wsConnector) { + super(wsConnector, "api/sources"); + } + + /** + * Show line line hashes for a given file. Require See Source Code permission on file's project
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ + public String hash(HashRequest request) { + return call( + new GetRequest(path("hash")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code as line number / text pairs. Require See Source Code permission on file + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("from", request.getFrom()) + .setParam("resource", request.getResource()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show source code with line oriented info. Require See Source Code permission on file's project
        Each element of the result array is an object which contains:
        1. Line number
        2. Content of the line
        3. Author of the line (from SCM information)
        4. Revision of the line (from SCM information)
        5. Last commit date of the line (from SCM information)
        6. Line hits from coverage
        7. Number of conditions to cover in tests
        8. Number of conditions covered by tests
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ + public String lines(LinesRequest request) { + return call( + new GetRequest(path("lines")) + .setParam("branch", request.getBranch()) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setParam("uuid", request.getUuid()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code as raw text. Require 'See Source Code' permission on file + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.0 + */ + public String raw(RawRequest request) { + return call( + new GetRequest(path("raw")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get SCM information of source files. Require See Source Code permission on file's project
        Each element of the result array is composed of:
        1. Line number
        2. Author of the commit
        3. Datetime of the commit (before 5.2 it was only the Date)
        4. Revision of the commit (added in 5.2)
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String scm(ScmRequest request) { + return call( + new GetRequest(path("scm")) + .setParam("commits_by_line", request.getCommitsByLine()) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code. Require See Source Code permission on file's project
        Each element of the result array is composed of:
        1. Line number
        2. Content of the line
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/package-info.java new file mode 100644 index 00000000000..06a8b91a35a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/sources/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.sources; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java new file mode 100644 index 00000000000..9d0d4d23ee0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ChangeLogLevelRequest { + + private String level; + + /** + * The new level. Be cautious: DEBUG, and even more TRACE, may have performance impacts. + * + * This is a mandatory parameter. + * Possible values: + *
          + *
        • "TRACE"
        • + *
        • "DEBUG"
        • + *
        • "INFO"
        • + *
        + */ + public ChangeLogLevelRequest setLevel(String level) { + this.level = level; + return this; + } + + public String getLevel() { + return level; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java new file mode 100644 index 00000000000..fb82bd56dda --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get system logs in plain-text format. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class LogsRequest { + + private String process; + + /** + * Process to get logs from + * + * Possible values: + *
          + *
        • "app"
        • + *
        • "ce"
        • + *
        • "es"
        • + *
        • "web"
        • + *
        + */ + public LogsRequest setProcess(String process) { + this.process = process; + return this; + } + + public String getProcess() { + return process; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/SystemService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/SystemService.java new file mode 100644 index 00000000000..b4b3afa257b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/SystemService.java @@ -0,0 +1,192 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.System.HealthResponse; +import org.sonarqube.ws.System.StatusResponse; + +/** + * Get system details, and perform some management actions, such as restarting, and initiating a database migration (as part of a system upgrade). + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SystemService extends BaseService { + + public SystemService(WsConnector wsConnector) { + super(wsConnector, "api/system"); + } + + /** + * Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void changeLogLevel(ChangeLogLevelRequest request) { + call( + new PostRequest(path("change_log_level")) + .setParam("level", request.getLevel()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display the database migration status of SonarQube.
        State values are:
        • NO_MIGRATION: DB is up to date with current version of SonarQube.
        • NOT_SUPPORTED: Migration is not supported on embedded databases.
        • MIGRATION_RUNNING: DB migration is under go.
        • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
        • MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).
        • MIGRATION_REQUIRED: DB migration is required.
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String dbMigrationStatus() { + return call( + new GetRequest(path("db_migration_status")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Provide health status of SonarQube.

        Require 'Administer System' permission or authentication with passcode

        • GREEN: SonarQube is fully operational
        • YELLOW: SonarQube is usable, but it needs attention in order to be fully operational
        • RED: SonarQube is not operational

        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.6 + */ + public HealthResponse health() { + return call( + new GetRequest(path("health")), + HealthResponse.parser()); + } + + /** + * Get detailed information about system configuration.
        Requires 'Administer' permissions.
        Since 5.5, this web service becomes internal in order to more easily update result. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.1 + */ + public String info() { + return call( + new GetRequest(path("info")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get system logs in plain-text format. Requires system administration permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String logs(LogsRequest request) { + return call( + new GetRequest(path("logs")) + .setParam("process", request.getProcess()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Migrate the database to match the current version of SonarQube.
        Sending a POST request to this URL starts the DB migration. It is strongly advised to make a database backup before invoking this WS.
        State values are:
        • NO_MIGRATION: DB is up to date with current version of SonarQube.
        • NOT_SUPPORTED: Migration is not supported on embedded databases.
        • MIGRATION_RUNNING: DB migration is under go.
        • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
        • MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).
        • MIGRATION_REQUIRED: DB migration is required.
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String migrateDb() { + return call( + new PostRequest(path("migrate_db")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Answers "pong" as plain-text + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.3 + */ + public String ping() { + return call( + new GetRequest(path("ping")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Restart server. Require 'Administer System' permission. Perform a full restart of the Web, Search and Compute Engine Servers processes. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.3 + */ + public void restart() { + call( + new PostRequest(path("restart")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get state information about SonarQube.

        status: the running status

        • STARTING: SonarQube Web Server is up and serving some Web Services (eg. api/system/status) but initialization is still ongoing
        • UP: SonarQube instance is up and running
        • DOWN: SonarQube instance is up but not running because migration has failed (refer to WS /api/system/migrate_db for details) or some other reason (check logs).
        • RESTARTING: SonarQube instance is still up but a restart has been requested (refer to WS /api/system/restart for details).
        • DB_MIGRATION_NEEDED: database migration is required. DB migration can be started using WS /api/system/migrate_db.
        • DB_MIGRATION_RUNNING: DB migration is running (refer to WS /api/system/migrate_db for details)

        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public StatusResponse status() { + return call( + new GetRequest(path("status")), + StatusResponse.parser()); + } + + /** + * Lists available upgrades for the SonarQube instance (if any) and for each one, lists incompatible plugins and plugins requiring upgrade.
        Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String upgrades() { + return call( + new GetRequest(path("upgrades")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/package-info.java new file mode 100644 index 00000000000..86b11d9949b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/system/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.system; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java new file mode 100644 index 00000000000..dc1004f517a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of source files covered by a test. Require Browse permission on test file's project + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CoveredFilesRequest { + + private String p; + private String ps; + private String testId; + + /** + * 1-based page number + * + * Example value: "42" + */ + public CoveredFilesRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public CoveredFilesRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Test ID + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CoveredFilesRequest setTestId(String testId) { + this.testId = testId; + return this; + } + + public String getTestId() { + return testId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java new file mode 100644 index 00000000000..e1b7d25a7e3 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java @@ -0,0 +1,172 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of tests either in a test file or that test a given line of source code.
        Requires 'Browse' permission on the file's project.
        One (and only one) of the following combination of parameters must be provided:
        • testId - get a specific test
        • testFileId - get the tests in a test file
        • testFileKey - get the tests in a test file
        • sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code
        • sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code
        + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListRequest { + + private String branch; + private String p; + private String ps; + private String sourceFileId; + private String sourceFileKey; + private String sourceFileLineNumber; + private String testFileId; + private String testFileKey; + private String testId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ListRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ListRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ListRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * ID of source file. Must be provided with the source file line number. + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ListRequest setSourceFileId(String sourceFileId) { + this.sourceFileId = sourceFileId; + return this; + } + + public String getSourceFileId() { + return sourceFileId; + } + + /** + * Key of source file. Must be provided with the source file line number. + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public ListRequest setSourceFileKey(String sourceFileKey) { + this.sourceFileKey = sourceFileKey; + return this; + } + + public String getSourceFileKey() { + return sourceFileKey; + } + + /** + * Source file line number. Must be provided with the source file ID or key. + * + * Example value: "10" + */ + public ListRequest setSourceFileLineNumber(String sourceFileLineNumber) { + this.sourceFileLineNumber = sourceFileLineNumber; + return this; + } + + public String getSourceFileLineNumber() { + return sourceFileLineNumber; + } + + /** + * ID of test file + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ListRequest setTestFileId(String testFileId) { + this.testFileId = testFileId; + return this; + } + + public String getTestFileId() { + return testFileId; + } + + /** + * Key of test file + * + * Example value: "MY_PROJECT:src/test/java/foo/BarTest.java" + */ + public ListRequest setTestFileKey(String testFileKey) { + this.testFileKey = testFileKey; + return this; + } + + public String getTestFileKey() { + return testFileKey; + } + + /** + * ID of test + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public ListRequest setTestId(String testId) { + this.testId = testId; + return this; + } + + public String getTestId() { + return testId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/TestsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/TestsService.java new file mode 100644 index 00000000000..07df0456727 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/TestsService.java @@ -0,0 +1,86 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Tests.CoveredFilesResponse; +import org.sonarqube.ws.Tests.ListResponse; + +/** + * Get details on test files. See also api/sources. Deprecated since 5.6. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TestsService extends BaseService { + + public TestsService(WsConnector wsConnector) { + super(wsConnector, "api/tests"); + } + + /** + * Get the list of source files covered by a test. Require Browse permission on test file's project + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + * @deprecated since 5.6 + */ + @Deprecated + public CoveredFilesResponse coveredFiles(CoveredFilesRequest request) { + return call( + new GetRequest(path("covered_files")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("testId", request.getTestId()), + CoveredFilesResponse.parser()); + } + + /** + * Get the list of tests either in a test file or that test a given line of source code.
        Requires 'Browse' permission on the file's project.
        One (and only one) of the following combination of parameters must be provided:
        • testId - get a specific test
        • testFileId - get the tests in a test file
        • testFileKey - get the tests in a test file
        • sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code
        • sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code
        + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + * @deprecated since 5.6 + */ + @Deprecated + public ListResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("branch", request.getBranch()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("sourceFileId", request.getSourceFileId()) + .setParam("sourceFileKey", request.getSourceFileKey()) + .setParam("sourceFileLineNumber", request.getSourceFileLineNumber()) + .setParam("testFileId", request.getTestFileId()) + .setParam("testFileKey", request.getTestFileKey()) + .setParam("testId", request.getTestId()), + ListResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/package-info.java new file mode 100644 index 00000000000..3884257898d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/tests/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.tests; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java new file mode 100644 index 00000000000..536a1d7239c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.timemachine; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/measures/search_history instead + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class TimemachineService extends BaseService { + + public TimemachineService(WsConnector wsConnector) { + super(wsConnector, "api/timemachine"); + } + + /** + * The web service is removed and you're invited to use api/measures/search_history instead + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java new file mode 100644 index 00000000000..81ff8ac0a3b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.timemachine; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java new file mode 100644 index 00000000000..fe33014fca0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java @@ -0,0 +1,54 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of all the plugins installed on the SonarQube instance + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 2.10 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class InstalledPluginsRequest { + + private String format; + + /** + * Only json response format is available + * + * Possible values: + *
          + *
        • "json"
        • + *
        + */ + public InstalledPluginsRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java new file mode 100644 index 00000000000..7a6d180a64c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get list of installed plugins + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdatecenterService extends BaseService { + + public UpdatecenterService(WsConnector wsConnector) { + super(wsConnector, "api/updatecenter"); + } + + /** + * Get the list of all the plugins installed on the SonarQube instance + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String installedPlugins(InstalledPluginsRequest request) { + return call( + new GetRequest(path("installed_plugins")) + .setParam("format", request.getFormat()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Upload a plugin.
        Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ + public void upload(UploadRequest request) { + call( + new PostRequest(path("upload")) + .setParam("file", request.getFile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java new file mode 100644 index 00000000000..56a80b9fabb --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Upload a plugin.
        Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.0 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UploadRequest { + + private String file; + + /** + * The jar file of the plugin to install + * + * This is a mandatory parameter. + */ + public UploadRequest setFile(String file) { + this.file = file; + return this; + } + + public String getFile() { + return file; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java new file mode 100644 index 00000000000..71095e82a09 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.updatecenter; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java new file mode 100644 index 00000000000..e5e61be545e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Add a user to a group.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class AddUserRequest { + + private String id; + private String login; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public AddUserRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * User login + * + * Example value: "g.hopper" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public AddUserRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java new file mode 100644 index 00000000000..016304881ae --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String description; + private String name; + private String organization; + + /** + * Description for the new group. A group description cannot be larger than 200 characters. + * + * Example value: "Default group for new users" + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Name for the new group. A group name cannot be larger than 255 characters and must be unique. The value 'anyone' (whatever the case) is reserved and cannot be used. + * + * This is a mandatory parameter. + * Example value: "sonar-users" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization. If unset then default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java new file mode 100644 index 00000000000..c94631f6e8b --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete a group. The default groups cannot be deleted.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeleteRequest { + + private String id; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public DeleteRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java new file mode 100644 index 00000000000..46060ea8f33 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a user from a group.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RemoveUserRequest { + + private String id; + private String login; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveUserRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * User login + * + * Example value: "g.hopper" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public RemoveUserRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java new file mode 100644 index 00000000000..85cafc45a3d --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for user groups.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
          + *
        • "name"
        • + *
        • "description"
        • + *
        • "membersCount"
        • + *
        + */ + public SearchRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * Key of organization. If not set then groups are searched in default organization. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names that contain the supplied string. + * + * Example value: "sonar-users" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java new file mode 100644 index 00000000000..c9447fe970c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String id; + private String name; + + /** + * New optional description for the group. A group description cannot be larger than 200 characters. If value is not defined, then description is not changed. + * + * Example value: "Default group for new users" + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Identifier of the group. + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * New optional name for the group. A group name cannot be larger than 255 characters and must be unique. Value 'anyone' (whatever the case) is reserved and cannot be used. If value is empty or not defined, then name is not changed. + * + * Example value: "my-group" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java new file mode 100644 index 00000000000..e7abd46433a --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java @@ -0,0 +1,174 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.UserGroups.CreateWsResponse; +import org.sonarqube.ws.UserGroups.SearchWsResponse; +import org.sonarqube.ws.UserGroups.UpdateWsResponse; + +/** + * Manage user groups. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UserGroupsService extends BaseService { + + public UserGroupsService(WsConnector wsConnector) { + super(wsConnector, "api/user_groups"); + } + + /** + * Add a user to a group.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("id", request.getId()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()), + CreateWsResponse.parser()); + } + + /** + * Delete a group. The default groups cannot be deleted.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a user from a group.
        'id' or 'name' must be provided.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("id", request.getId()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for user groups.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchWsResponse.parser()); + } + + /** + * Update a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("name", request.getName()), + UpdateWsResponse.parser()); + } + + /** + * Search for users with membership information with respect to a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public String users(UsersRequest request) { + return call( + new GetRequest(path("users")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java new file mode 100644 index 00000000000..7edc7c4f380 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java @@ -0,0 +1,147 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for users with membership information with respect to a group.
        Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UsersRequest { + + private String id; + private String name; + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Group id + * + * Example value: "42" + */ + public UsersRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public UsersRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public UsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public UsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "freddy" + */ + public UsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
          + *
        • "all"
        • + *
        • "deselected"
        • + *
        • "selected"
        • + *
        + */ + public UsersRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/package-info.java new file mode 100644 index 00000000000..fd91b8c99ac --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usergroups/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.usergroups; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java new file mode 100644 index 00000000000..a7f16807068 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.userproperties; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/favorites and api/notifications instead + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UserPropertiesService extends BaseService { + + public UserPropertiesService(WsConnector wsConnector) { + super(wsConnector, "api/user_properties"); + } + + /** + * This web service is removed + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java new file mode 100644 index 00000000000..2e6ccc12bce --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.userproperties; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java new file mode 100644 index 00000000000..c3c0d8b073f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ChangePasswordRequest { + + private String login; + private String password; + private String previousPassword; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public ChangePasswordRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * New password + * + * This is a mandatory parameter. + * Example value: "mypassword" + */ + public ChangePasswordRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } + + /** + * Previous password. Required when changing one's own password. + * + * Example value: "oldpassword" + */ + public ChangePasswordRequest setPreviousPassword(String previousPassword) { + this.previousPassword = previousPassword; + return this; + } + + public String getPreviousPassword() { + return previousPassword; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java new file mode 100644 index 00000000000..8c393179ab2 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java @@ -0,0 +1,151 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Create a user.
        If a deactivated user account exists with the given login, it will be reactivated.
        Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class CreateRequest { + + private String email; + private String local; + private String login; + private String name; + private String password; + private String scmAccount; + private String scmAccounts; + + /** + * User email + * + * Example value: "myname@email.com" + */ + public CreateRequest setEmail(String email) { + this.email = email; + return this; + } + + public String getEmail() { + return email; + } + + /** + * Specify if the user should be authenticated from SonarQube server or from an external authentication system. Password should not be set when local is set to false. + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public CreateRequest setLocal(String local) { + this.local = local; + return this; + } + + public String getLocal() { + return local; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public CreateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * User name + * + * This is a mandatory parameter. + * Example value: "My Name" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * User password. Only mandatory when creating local user, otherwise it should not be set + * + * Example value: "mypassword" + */ + public CreateRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } + + /** + * SCM accounts. To set several values, the parameter must be called once for each value. + * + * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + */ + public CreateRequest setScmAccount(String scmAccount) { + this.scmAccount = scmAccount; + return this; + } + + public String getScmAccount() { + return scmAccount; + } + + /** + * This parameter is deprecated, please use 'scmAccount' instead + * + * Example value: "myscmaccount1,myscmaccount2" + * @deprecated since 6.1 + */ + @Deprecated + public CreateRequest setScmAccounts(String scmAccounts) { + this.scmAccounts = scmAccounts; + return this; + } + + public String getScmAccounts() { + return scmAccounts; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java new file mode 100644 index 00000000000..db782e720e6 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Deactivate a user. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeactivateRequest { + + private String login; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public DeactivateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java new file mode 100644 index 00000000000..96d4a852b5c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java @@ -0,0 +1,133 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Lists the groups a user belongs to.
        Requires Administer System permission. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class GroupsRequest { + + private String login; + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public GroupsRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public GroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public GroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. + * + * Example value: "users" + */ + public GroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + *
          + *
        • "all"
        • + *
        • "deselected"
        • + *
        • "selected"
        • + *
        + */ + public GroupsRequest setSelected(String selected) { + this.selected = selected; + return this; + } + + public String getSelected() { + return selected; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java new file mode 100644 index 00000000000..da2ba945342 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java @@ -0,0 +1,108 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get a list of active users.
        Administer System permission is required to show the 'groups' field.
        When accessed anonymously, only logins and names are returned. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private List f; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + *
          + *
        • "name"
        • + *
        • "email"
        • + *
        • "avatart"
        • + *
        • "scmAccounts"
        • + *
        • "groups"
        • + *
        • "active"
        • + *
        • "local"
        • + *
        • "externalIdentity"
        • + *
        • "externalProvider"
        • + *
        + * @deprecated since 5.4 + */ + @Deprecated + public SearchRequest setF(List f) { + this.f = f; + return this; + } + + public List getF() { + return f; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter on login or name. + * + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java new file mode 100644 index 00000000000..c794135d2a0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java @@ -0,0 +1,114 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UpdateRequest { + + private String email; + private String login; + private String name; + private String scmAccount; + private String scmAccounts; + + /** + * User email + * + * Example value: "myname@email.com" + */ + public UpdateRequest setEmail(String email) { + this.email = email; + return this; + } + + public String getEmail() { + return email; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public UpdateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * User name + * + * Example value: "My Name" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * SCM accounts. To set several values, the parameter must be called once for each value. + * + * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + */ + public UpdateRequest setScmAccount(String scmAccount) { + this.scmAccount = scmAccount; + return this; + } + + public String getScmAccount() { + return scmAccount; + } + + /** + * This parameter is deprecated, please use 'scmAccount' instead + * + * Example value: "myscmaccount1,myscmaccount2" + * @deprecated since 6.1 + */ + @Deprecated + public UpdateRequest setScmAccounts(String scmAccounts) { + this.scmAccounts = scmAccounts; + return this; + } + + public String getScmAccounts() { + return scmAccounts; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UsersService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UsersService.java new file mode 100644 index 00000000000..fab6eb53103 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/UsersService.java @@ -0,0 +1,201 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Users.CreateWsResponse; +import org.sonarqube.ws.Users.CurrentWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse; +import org.sonarqube.ws.Users.IdentityProvidersWsResponse; +import org.sonarqube.ws.Users.SearchWsResponse; + +/** + * Manage users. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UsersService extends BaseService { + + public UsersService(WsConnector wsConnector) { + super(wsConnector, "api/users"); + } + + /** + * Update a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public void changePassword(ChangePasswordRequest request) { + call( + new PostRequest(path("change_password")) + .setParam("login", request.getLogin()) + .setParam("password", request.getPassword()) + .setParam("previousPassword", request.getPreviousPassword()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a user.
        If a deactivated user account exists with the given login, it will be reactivated.
        Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("email", request.getEmail()) + .setParam("local", request.getLocal()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("password", request.getPassword()) + .setParam("scmAccount", request.getScmAccount()) + .setParam("scmAccounts", request.getScmAccounts()), + CreateWsResponse.parser()); + } + + /** + * Get the details of the current authenticated user. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public CurrentWsResponse current() { + return call( + new GetRequest(path("current")), + CurrentWsResponse.parser()); + } + + /** + * Deactivate a user. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ + public String deactivate(DeactivateRequest request) { + return call( + new PostRequest(path("deactivate")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups a user belongs to.
        Requires Administer System permission. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.2 + */ + public GroupsWsResponse groups(GroupsRequest request) { + return call( + new GetRequest(path("groups")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()), + GroupsWsResponse.parser()); + } + + /** + * List the external identity providers + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.5 + */ + public IdentityProvidersWsResponse identityProviders() { + return call( + new GetRequest(path("identity_providers")), + IdentityProvidersWsResponse.parser()); + } + + /** + * Get a list of active users.
        Administer System permission is required to show the 'groups' field.
        When accessed anonymously, only logins and names are returned. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 3.6 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchWsResponse.parser()); + } + + /** + * Stores that the user has skipped the onboarding tutorial and does not want to see it after future logins.
        Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.5 + */ + public void skipOnboardingTutorial() { + call( + new PostRequest(path("skip_onboarding_tutorial")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 3.7 + */ + public String update(UpdateRequest request) { + return call( + new PostRequest(path("update")) + .setParam("email", request.getEmail()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("scmAccount", request.getScmAccount()) + .setParam("scmAccounts", request.getScmAccounts()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/package-info.java new file mode 100644 index 00000000000..8076ca836b0 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/users/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.users; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java new file mode 100644 index 00000000000..df6c290208f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Generate a user access token.
        Please keep your tokens secret. They enable to authenticate and analyze projects.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class GenerateRequest { + + private String login; + private String name; + + /** + * User login. If not set, the token is generated for the authenticated user. + * + * Example value: "g.hopper" + */ + public GenerateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Token name + * + * This is a mandatory parameter. + * Example value: "Project scan on Travis" + */ + public GenerateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java new file mode 100644 index 00000000000..13e482f11d7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Revoke a user access token.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class RevokeRequest { + + private String login; + private String name; + + /** + * User login + * + * Example value: "g.hopper" + */ + public RevokeRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Token name + * + * This is a mandatory parameter. + * Example value: "Project scan on Travis" + */ + public RevokeRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java new file mode 100644 index 00000000000..b8116f7da7c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List the access tokens of a user.
        The login must exist and active.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class SearchRequest { + + private String login; + + /** + * User login + * + * Example value: "g.hopper" + */ + public SearchRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java new file mode 100644 index 00000000000..bb8890ccb49 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java @@ -0,0 +1,90 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.UserTokens.GenerateWsResponse; +import org.sonarqube.ws.UserTokens.SearchWsResponse; + +/** + * List, create, and delete a user's access tokens. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class UserTokensService extends BaseService { + + public UserTokensService(WsConnector wsConnector) { + super(wsConnector, "api/user_tokens"); + } + + /** + * Generate a user access token.
        Please keep your tokens secret. They enable to authenticate and analyze projects.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ + public GenerateWsResponse generate(GenerateRequest request) { + return call( + new PostRequest(path("generate")) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()), + GenerateWsResponse.parser()); + } + + /** + * Revoke a user access token.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ + public void revoke(RevokeRequest request) { + call( + new PostRequest(path("revoke")) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the access tokens of a user.
        The login must exist and active.
        If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 5.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("login", request.getLogin()), + SearchWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java new file mode 100644 index 00000000000..cca27eb2dec --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.usertokens; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java new file mode 100644 index 00000000000..9179bbdd11e --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the recent deliveries for a specified project or Compute Engine task.
        Require 'Administer' permission on the related project.
        Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeliveriesRequest { + + private String ceTaskId; + private String componentKey; + + /** + * Id of the Compute Engine task + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeliveriesRequest setCeTaskId(String ceTaskId) { + this.ceTaskId = ceTaskId; + return this; + } + + public String getCeTaskId() { + return ceTaskId; + } + + /** + * Key of the project + * + * Example value: "my-project" + */ + public DeliveriesRequest setComponentKey(String componentKey) { + this.componentKey = componentKey; + return this; + } + + public String getComponentKey() { + return componentKey; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java new file mode 100644 index 00000000000..85d247e8540 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get a webhook delivery by its id.
        Require 'Administer System' permission.
        Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class DeliveryRequest { + + private String deliveryId; + + /** + * Id of delivery + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL3" + */ + public DeliveryRequest setDeliveryId(String deliveryId) { + this.deliveryId = deliveryId; + return this; + } + + public String getDeliveryId() { + return deliveryId; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java new file mode 100644 index 00000000000..7bea28f9702 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Webhooks.DeliveriesWsResponse; +import org.sonarqube.ws.Webhooks.DeliveryWsResponse; + +/** + * Webhooks allow to notify external services when a project analysis is done + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class WebhooksService extends BaseService { + + public WebhooksService(WsConnector wsConnector) { + super(wsConnector, "api/webhooks"); + } + + /** + * Get the recent deliveries for a specified project or Compute Engine task.
        Require 'Administer' permission on the related project.
        Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public DeliveriesWsResponse deliveries(DeliveriesRequest request) { + return call( + new GetRequest(path("deliveries")) + .setParam("ceTaskId", request.getCeTaskId()) + .setParam("componentKey", request.getComponentKey()), + DeliveriesWsResponse.parser()); + } + + /** + * Get a webhook delivery by its id.
        Require 'Administer System' permission.
        Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 6.2 + */ + public DeliveryWsResponse delivery(DeliveryRequest request) { + return call( + new GetRequest(path("delivery")) + .setParam("deliveryId", request.getDeliveryId()), + DeliveryWsResponse.parser()); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java new file mode 100644 index 00000000000..adb8d2d7fe8 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.webhooks; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java new file mode 100644 index 00000000000..5e8b30b252c --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List web services + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ListRequest { + + private String includeInternals; + + /** + * Include web services that are implemented for internal use only. Their forward-compatibility is not assured + * + * Possible values: + *
          + *
        • "true"
        • + *
        • "false"
        • + *
        • "yes"
        • + *
        • "no"
        • + *
        + */ + public ListRequest setIncludeInternals(String includeInternals) { + this.includeInternals = includeInternals; + return this; + } + + public String getIncludeInternals() { + return includeInternals; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java new file mode 100644 index 00000000000..c5ea6d3320f --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Display web service response example + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class ResponseExampleRequest { + + private String action; + private String controller; + + /** + * Action of the web service + * + * This is a mandatory parameter. + * Example value: "search" + */ + public ResponseExampleRequest setAction(String action) { + this.action = action; + return this; + } + + public String getAction() { + return action; + } + + /** + * Controller of the web service + * + * This is a mandatory parameter. + * Example value: "api/issues" + */ + public ResponseExampleRequest setController(String controller) { + this.controller = controller; + return this; + } + + public String getController() { + return controller; + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java new file mode 100644 index 00000000000..0a23dc3fd84 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information on the web api supported on this instance. + * @see Further information about this web service online + */ +@Generated("https://github.com/SonarSource/sonar-ws-generator") +public class WebservicesService extends BaseService { + + public WebservicesService(WsConnector wsConnector) { + super(wsConnector, "api/webservices"); + } + + /** + * List web services + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.2 + */ + public String list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("include_internals", request.getIncludeInternals()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display web service response example + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 4.4 + */ + public String responseExample(ResponseExampleRequest request) { + return call( + new GetRequest(path("response_example")) + .setParam("action", request.getAction()) + .setParam("controller", request.getController()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/package-info.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/package-info.java new file mode 100644 index 00000000000..d8ec8cbb9d7 --- /dev/null +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/webservices/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.webservices; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generated/src/main/protobuf/ws-batch.proto b/sonar-ws-generated/src/main/protobuf/ws-batch.proto new file mode 100644 index 00000000000..11a696da9e8 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-batch.proto @@ -0,0 +1,47 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.batch; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Batch"; + +option optimize_for = SPEED; + +// WS batch/project +message WsProjectResponse { + optional int64 timestamp = 1; + map settingsByModule = 2; + map fileDataByModuleAndPath = 3; + optional int64 lastAnalysisDate = 4; + + message Settings { + map settings = 1; + } + + message FileDataByPath { + map FileDataByPath = 1; + } + + message FileData { + optional string hash = 1; + optional string revision = 2; + } +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-ce.proto b/sonar-ws-generated/src/main/protobuf/ws-ce.proto new file mode 100644 index 00000000000..61961d6ebd7 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-ce.proto @@ -0,0 +1,103 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.ce; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Ce"; +option optimize_for = SPEED; + +// POST api/ce/submit +message SubmitResponse { + optional string taskId = 1; + optional string projectId = 2; +} + +// GET api/ce/task +message TaskResponse { + optional Task task = 1; +} + +// GET api/ce/activity +message ActivityResponse { + // paging has been deprecated in 5.5 + optional sonarqube.ws.commons.Paging unusedPaging = 1; + repeated Task tasks = 2; +} + +// GET api/ce/activity_status +message ActivityStatusWsResponse { + optional int32 pending = 1; + optional int32 failing = 2; + optional int32 inProgress = 3; +} + +// GET api/ce/component +message ProjectResponse { + repeated Task queue = 1; + optional Task current = 2; +} + +// GET api/ce/task_types +message TaskTypesWsResponse { + repeated string taskTypes = 1; +} + +// GET api/ce/worker_count +message WorkerCountResponse { + optional int32 value = 1; + optional bool canSetWorkerCount = 2; +} + +message Task { + optional string id = 1; + optional string type = 2; + optional string componentId = 3; + optional string componentKey = 4; + optional string componentName = 5; + optional string componentQualifier = 6; + optional string analysisId = 7; + optional TaskStatus status = 8; + optional string submittedAt = 9; + optional string submitterLogin = 10; + optional string startedAt = 11; + optional string executedAt = 12; + optional bool isLastExecuted = 13; + optional int64 executionTimeMs = 14; + optional bool logs = 15; + optional string errorMessage = 16; + optional string errorStacktrace = 17; + optional string scannerContext = 18; + optional bool hasScannerContext = 19; + optional string organization = 20; + optional string branch = 21; + optional sonarqube.ws.commons.BranchType branchType = 22; + optional string errorType = 23; +} + +enum TaskStatus { + PENDING = 0; + IN_PROGRESS = 1; + SUCCESS = 2; + FAILED = 3; + CANCELED = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-commons.proto b/sonar-ws-generated/src/main/protobuf/ws-commons.proto new file mode 100644 index 00000000000..a9b566583e3 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-commons.proto @@ -0,0 +1,124 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.commons; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Common"; +option optimize_for = SPEED; + +message Paging { + optional int32 pageIndex = 1; + optional int32 pageSize = 2; + optional int32 total = 3; +} + +message Facet { + // kind of key + optional string property = 1; + repeated FacetValue values = 2; +} + +message Facets { + repeated Facet facets = 1; +} + +message FacetValue { + optional string val = 1; + optional int64 count = 2; +} + +enum Severity { + INFO = 0; + MINOR = 1; + MAJOR = 2; + CRITICAL = 3; + BLOCKER = 4; +} + +message Rule { + optional string key = 1; + optional string name = 2; + optional string lang = 3; + optional RuleStatus status = 4; + optional string langName = 5; +} + +message Rules { + repeated Rule rules = 1; +} + +enum RuleStatus { + BETA = 0; + DEPRECATED = 1; + READY = 2; + REMOVED = 3; +} + +// Lines start at 1 and line offsets start at 0 +message TextRange { + // Start line. Should never be absent + optional int32 startLine = 1; + + // End line (inclusive). Absent means it is same as start line + optional int32 endLine = 2; + + // If absent it means range starts at the first offset of start line + optional int32 startOffset = 3; + + // If absent it means range ends at the last offset of end line + optional int32 endOffset = 4; +} + +message Metric { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional string domain = 4; + optional string type = 5; + optional bool higherValuesAreBetter = 6; + optional bool qualitative = 7; + optional bool hidden = 8; + optional bool custom = 9; + optional int32 decimalScale = 10; + optional string bestValue = 11; + optional string worstValue = 12; +} + +enum RuleType { + // Zero is required in order to not get MAINTAINABILITY as default value + // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ + UNKNOWN = 0; + + // same name as in Java enum IssueType, + // same index values as in database (see column ISSUES.ISSUE_TYPE) + CODE_SMELL = 1; + BUG = 2; + VULNERABILITY = 3; +} + +enum BranchType { + // Zero is required in order to not get LONG as default value + // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ + UNKNOWN_BRANCH_TYPE = 0; + + LONG = 1; + SHORT = 2; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-components.proto b/sonar-ws-generated/src/main/protobuf/ws-components.proto new file mode 100644 index 00000000000..73059133649 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-components.proto @@ -0,0 +1,130 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.component; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Components"; +option optimize_for = SPEED; + +// WS api/components/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; +} + +// WS api/components/tree +message TreeWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component baseComponent = 3; + repeated Component components = 4; +} + +// WS api/components/show +message ShowWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component component = 2; + repeated Component ancestors = 3; +} + +// WS api/components/suggestions +message SuggestionsWsResponse { + repeated Category results = 1; + optional string warning = 2; + repeated Organization organizations = 3; + repeated Project projects = 4; + + message Category { + optional string q = 1; + repeated Suggestion items = 2; + optional int64 more = 3; + } + + message Suggestion { + optional string key = 1; + optional string name = 2; + optional string match = 3; + optional string organization = 4; + optional string project = 5; + optional bool isRecentlyBrowsed = 6; + optional bool isFavorite = 7; + } + + message Organization { + optional string key = 1; + optional string name = 2; + } + + message Project { + optional string key = 1; + optional string name = 2; + } +} + +// WS api/components/search_projects +message SearchProjectsWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; + optional sonarqube.ws.commons.Facets facets = 3; +} + +// WS api/components/provisioned +message ProvisionedWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component projects = 2; + + message Component { + optional string uuid = 1; + optional string key = 2; + optional string name = 3; + optional string creationDate = 4; + optional string visibility = 5; + } +} + +message Component { + optional string organization = 12; + optional string id = 1; + optional string key = 2; + optional string refId = 3; + optional string refKey = 4; + optional string projectId = 5; + optional string name = 6; + optional string description = 7; + optional string qualifier = 8; + optional string path = 9; + optional string language = 10; + optional bool isFavorite = 11; + optional string analysisDate = 13; + optional Tags tags = 14; + optional string visibility = 15; + optional string leakPeriodDate = 16; + // Root project key + optional string project = 17; + optional string branch = 18; + optional string version = 19; + + message Tags { + repeated string tags = 1; + } +} + diff --git a/sonar-ws-generated/src/main/protobuf/ws-duplications.proto b/sonar-ws-generated/src/main/protobuf/ws-duplications.proto new file mode 100644 index 00000000000..6eeb5f29a32 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-duplications.proto @@ -0,0 +1,55 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.duplication; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Duplications"; +option optimize_for = SPEED; + +// WS api/duplications/show +message ShowResponse { + repeated Duplication duplications = 1; + map files = 2; + +} + +message Duplication { + repeated Block blocks = 1; +} + +message Block { + int32 from = 1; + int32 size = 2; + string _ref = 3; +} + +message File { + string key = 1; + string name = 2; + string uuid = 3; + string project = 4; + string projectUuid = 5; + string projectName = 6; + string subProject = 7; + string subProjectUuid = 8; + string subProjectName = 9; + string branch = 10; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-editions.proto b/sonar-ws-generated/src/main/protobuf/ws-editions.proto new file mode 100644 index 00000000000..87531bb7331 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-editions.proto @@ -0,0 +1,60 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.editions; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Editions"; +option optimize_for = SPEED; + +// GET api/editions/status +// POST api/editions/apply_license +message StatusResponse { + optional string currentEditionKey = 1; + optional InstallationStatus installationStatus = 2; + optional string nextEditionKey = 3; + optional string installError = 4; +} + +enum InstallationStatus { + NONE = 0; + AUTOMATIC_IN_PROGRESS = 1; + AUTOMATIC_READY = 2; + MANUAL_IN_PROGRESS = 3; + UNINSTALL_IN_PROGRESS = 4; +} + +// POST api/editions/preview +message PreviewResponse { + optional string nextEditionKey = 1; + optional PreviewStatus previewStatus = 2; +} + +enum PreviewStatus { + NO_INSTALL = 0; + AUTOMATIC_INSTALL = 1; + MANUAL_INSTALL = 2; +} + +// POST api/editions/form_data +message FormDataResponse { + optional string serverId = 1; + optional int64 ncloc = 2; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-favorites.proto b/sonar-ws-generated/src/main/protobuf/ws-favorites.proto new file mode 100644 index 00000000000..7cdb6eceb94 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-favorites.proto @@ -0,0 +1,40 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.favorite; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Favorites"; +option optimize_for = SPEED; + +// WS api/favorites/search +message SearchResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Favorite favorites = 2; +} + +message Favorite { + optional string organization = 4; + optional string key = 1; + optional string name = 2; + optional string qualifier = 3; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-issues.proto b/sonar-ws-generated/src/main/protobuf/ws-issues.proto new file mode 100644 index 00000000000..a1309679f58 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-issues.proto @@ -0,0 +1,232 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.issues; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Issues"; +option optimize_for = SPEED; + +// Response of GET api/issues/search +message SearchWsResponse { + optional int64 total = 1; + optional int64 p = 2; + optional int32 ps = 3; + optional sonarqube.ws.commons.Paging paging = 4; + + // Total amount of effort, only when the facet "total" is enabled + optional int64 effortTotal = 13; + // Deprecated since 5.5, replaced by effortTotal + optional int64 debtTotal = 5; + + repeated Issue issues = 6; + repeated Component components = 7; + optional sonarqube.ws.commons.Rules rules = 8; + optional Users users = 9; + + // Deprecated since 5.5, action plan has been removed + optional ActionPlans unusedActionPlans = 10; + optional Languages languages = 11; + optional sonarqube.ws.commons.Facets facets = 12; +} + +// Response of most of POST/issues/{operation}, for instance assign, add_comment and set_severity +message Operation { + optional Issue issue = 1; + repeated Component components = 2; + repeated sonarqube.ws.commons.Rule rules = 3; + repeated Users.User users = 4; + // Deprecated since 5.5, action plan has been removed + repeated ActionPlan unusedActionPlans = 5; +} + +message Issue { + optional string key = 1; + optional string rule = 2; + optional sonarqube.ws.commons.Severity severity = 3; + optional string component = 4; + optional int64 unusedComponentId = 5; + optional string project = 6; + optional string subProject = 7; + optional int32 line = 8; + optional string hash = 31; + optional sonarqube.ws.commons.TextRange textRange = 9; + repeated Flow flows = 10; + optional string resolution = 11; + optional string status = 12; + optional string message = 13; + + optional string effort = 28; + // Deprecated since 5.5, replaced by effort + optional string debt = 14; + + optional string assignee = 15; + + // Unused since 5.5, manual issues feature has been removed + optional string unusedReporter = 16; + + // SCM login of the committer who introduced the issue + optional string author = 17; + + // Deprecated since 5.5, action plan has been removed + optional string actionPlan = 18; + + repeated string tags = 19; + + // the transitions allowed for the requesting user. + optional Transitions transitions = 20; + + // the actions allowed for the requesting user. + optional Actions actions = 21; + + optional Comments comments = 22; + optional string creationDate = 23; + optional string updateDate = 24; + optional string fUpdateAge = 25; + optional string closeDate = 26; + + optional sonarqube.ws.commons.RuleType type = 27; + + optional string organization = 29; + optional string branch = 30; +} + +message Transitions { + repeated string transitions = 1; +} + +message Actions { + repeated string actions = 1; +} + +message Flow { + repeated Location locations = 1; +} + +message Location { + optional string unusedComponentId = 1; + // Only when component is a file. Can be empty for a file if this is an issue global to the file. + optional sonarqube.ws.commons.TextRange textRange = 2; + optional string msg = 3; +} + +message Comment { + optional string key = 1; + optional string login = 2; + // TODO drop, it's already in field "users" + optional string email = 3; + // TODO drop, it's already in field "users" + optional string userName = 4; + optional string htmlText = 5; + // TODO rename markdownText ? + optional string markdown = 6; + optional bool updatable = 7; + optional string createdAt = 8; +} + +message Comments { + repeated Comment comments = 1; +} + +// Deprecated since 5.5 +message ActionPlan { + optional string key = 1; + optional string name = 2; + + // TODO define enum + optional string status = 3; + optional string deadLine = 4; + // TODO to be renamed, is it id or key ? + optional string project = 5; +} + +// Deprecated since 5.5 +message ActionPlans { + repeated ActionPlan actionPlans = 1; +} + +message Language { + optional string key = 1; + optional string name = 2; +} + +message Languages { + repeated Language languages = 1; +} + +message Component { + optional string organization = 11; + optional int64 deprecatedId = 1; + optional string key = 2; + optional string uuid = 3; + optional bool enabled = 4; + optional string qualifier = 5; + optional string name = 6; + optional string longName = 7; + optional string path = 8; + optional int64 unusedProjectId = 9; + optional int64 unusedSubProjectId = 10; + optional string branch = 12; +} + +// Response of GET api/issues/changelog +message ChangelogWsResponse { + repeated Changelog changelog = 1; + + message Changelog { + optional string user = 1; + optional string userName = 2; + // Email is no more returned since 6.3 + optional string deprecatedEmail = 3; + optional string creationDate = 4; + repeated Diff diffs = 5; + optional string avatar = 6; + + message Diff { + optional string key = 1; + optional string newValue = 2; + optional string oldValue = 3; + } + } +} + +// Response of POST api/issues/bulk_change +message BulkChangeWsResponse { + optional int64 total = 1; + optional int64 success = 2; + optional int64 ignored = 3; + optional int64 failures = 4; +} + +message Users { + repeated User users = 1; + + message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional bool active = 4; + } +} + + + diff --git a/sonar-ws-generated/src/main/protobuf/ws-measures.proto b/sonar-ws-generated/src/main/protobuf/ws-measures.proto new file mode 100644 index 00000000000..36cd4ab6174 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-measures.proto @@ -0,0 +1,110 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.measures; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Measures"; +option optimize_for = SPEED; + +// WS api/measures/component_tree +message ComponentTreeWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component baseComponent = 2; + repeated Component components = 3; + optional Metrics metrics = 4; + optional Periods periods = 5; +} + +// WS api/measures/component +message ComponentWsResponse { + optional Component component = 1; + optional Metrics metrics = 2; + optional Periods periods = 3; +} + +// WS api/measures/search +message SearchWsResponse { + repeated Measure measures = 1; +} + +// WS api/measures/search_history +message SearchHistoryResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated HistoryMeasure measures = 2; + + message HistoryMeasure { + optional string metric = 1; + repeated HistoryValue history = 2; + } + + message HistoryValue { + optional string date = 1; + optional string value = 2; + } +} + +message Component { + optional string id = 1; + optional string key = 2; + optional string refId = 3; + optional string refKey = 4; + optional string projectId = 5; + optional string name = 6; + optional string description = 7; + optional string qualifier = 8; + optional string path = 9; + optional string language = 10; + repeated Measure measures = 11; + optional string branch = 12; +} + +message Period { + optional int32 index = 1; + optional string mode = 2; + optional string date = 3; + optional string parameter = 4; +} + +message Periods { + repeated Period periods = 1; +} + +message Metrics { + repeated sonarqube.ws.commons.Metric metrics = 1; +} + +message Measure { + optional string metric = 1; + optional string value = 2; + optional PeriodsValue periods = 3; + optional string component = 4; +} + +message PeriodsValue { + repeated PeriodValue periodsValue = 1; +} + +message PeriodValue { + optional int32 index = 1; + optional string value = 2; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-notifications.proto b/sonar-ws-generated/src/main/protobuf/ws-notifications.proto new file mode 100644 index 00000000000..ac0cb034748 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-notifications.proto @@ -0,0 +1,41 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.notification; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Notifications"; +option optimize_for = SPEED; + +// WS api/notifications/list +message ListResponse { + repeated Notification notifications = 1; + repeated string channels = 2; + repeated string globalTypes = 3; + repeated string perProjectTypes = 4; +} + +message Notification { + optional string channel = 1; + optional string type = 2; + optional string organization = 5; + optional string project = 3; + optional string projectName = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-organizations.proto b/sonar-ws-generated/src/main/protobuf/ws-organizations.proto new file mode 100644 index 00000000000..f6f2733c772 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-organizations.proto @@ -0,0 +1,70 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.organizations; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Organizations"; +option optimize_for = SPEED; + +// WS api/organizations/create +message CreateWsResponse { + optional Organization organization = 1; +} + +// WS api/organizations/update +message UpdateWsResponse { + optional Organization organization = 1; +} + +// WS api/organizations/search +message SearchWsResponse { + repeated Organization organizations = 1; + optional sonarqube.ws.commons.Paging paging = 2; +} + +// WS api/organizations/search_members +message SearchMembersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; +} + +// WS api/organizations/add_member +message AddMemberWsResponse { + optional User user = 1; +} + +message Organization { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional string url = 4; + optional string avatar = 5; + optional bool guarded = 6; +} + +message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional int32 groupCount = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-permissions.proto b/sonar-ws-generated/src/main/protobuf/ws-permissions.proto new file mode 100644 index 00000000000..53acf4d8ec4 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-permissions.proto @@ -0,0 +1,138 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.permissions; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Permissions"; +option optimize_for = SPEED; + +// WS api/permissions/template_users for internal use only +message OldUsersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated OldUser users = 2; +} + +// WS api/permissions/users for internal use only +message UsersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; +} + +// WS api/permissions/groups for internal use only +message WsGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; +} + +// WS api/permissions/template_groups for internal use only +message WsTemplateGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated OldGroup groups = 2; +} + +message WsSearchGlobalPermissionsResponse { + repeated Permission permissions = 1; +} + +message SearchProjectPermissionsWsResponse { + message Project { + optional string id = 1; + optional string key = 2; + optional string qualifier = 3; + optional string name = 4; + repeated Permission permissions = 5; + } + + optional sonarqube.ws.commons.Paging paging = 1; + repeated Project projects = 2; + repeated Permission permissions = 3; +} + +message CreateTemplateWsResponse { + optional PermissionTemplate permissionTemplate = 1; +} + +message UpdateTemplateWsResponse { + optional PermissionTemplate permissionTemplate = 1; +} + +message SearchTemplatesWsResponse { + message TemplateIdQualifier { + optional string templateId = 1; + optional string qualifier = 2; + } + + repeated PermissionTemplate permissionTemplates = 1; + repeated TemplateIdQualifier defaultTemplates = 2; + repeated Permission permissions = 3; +} + +message Permission { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional int32 usersCount = 4; + optional int32 groupsCount = 5; + optional bool withProjectCreator = 6; +} + +message PermissionTemplate { + optional string id = 1; + optional string name = 2; + optional string description = 3; + optional string projectKeyPattern = 4; + // ex: 2015-08-25T16:18:48+0200 + optional string createdAt = 5; + // ex: 2015-08-25T16:18:48+0200 + optional string updatedAt = 6; + repeated Permission permissions = 7; +} + +message OldUser { + optional string login = 1; + optional string name = 2; + optional string email = 3; + optional bool selected = 4; +} + +message User { + optional string login = 1; + optional string name = 2; + optional string email = 3; + repeated string permissions = 4; + optional string avatar = 5; +} + +message OldGroup { + optional string id = 1; + optional string name = 2; + optional string description = 3; + optional bool selected = 4; +} + +message Group { + optional string id = 1; + optional string name = 2; + optional string description = 3; + repeated string permissions = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-project_tags.proto b/sonar-ws-generated/src/main/protobuf/ws-project_tags.proto new file mode 100644 index 00000000000..86f1901a806 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-project_tags.proto @@ -0,0 +1,30 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.projects; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectTags"; +option optimize_for = SPEED; + +// Response for api/project_tags/search +message SearchResponse { + repeated string tags = 1; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-projectanalyses.proto b/sonar-ws-generated/src/main/protobuf/ws-projectanalyses.proto new file mode 100644 index 00000000000..3b4ea562bb9 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-projectanalyses.proto @@ -0,0 +1,57 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projectanalysis; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectAnalyses"; +option optimize_for = SPEED; + +// WS api/project_analyses/create_event +message CreateEventResponse { + optional Event event = 1; +} + +// WS api/project_analyses/update_event +message UpdateEventResponse { + optional Event event = 1; +} + +// WS api/project_analyses/search +message SearchResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Analysis analyses = 2; +} + +message Event { + optional string key = 1; + optional string analysis = 2; + optional string category = 3; + optional string name = 4; + optional string description = 5; +} + +message Analysis { + optional string key = 1; + optional string date = 2; + repeated Event events = 3; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-projectbranches.proto b/sonar-ws-generated/src/main/protobuf/ws-projectbranches.proto new file mode 100644 index 00000000000..55d8e4032ce --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-projectbranches.proto @@ -0,0 +1,60 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projectbranch; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectBranches"; +option optimize_for = SPEED; + +import "ws-commons.proto"; + +// WS api/project_branches/list +message ListWsResponse { + repeated Branch branches = 1; +} + +// WS api/project_branches/show +message ShowWsResponse { + optional Branch branch = 1; +} + +message Branch { + optional string name = 1; + optional bool isMain = 2; + optional sonarqube.ws.commons.BranchType type = 3; + // Merge branch is only present for short living branch + optional string mergeBranch = 4; + optional Status status = 5; + optional bool isOrphan = 6; + optional string analysisDate = 7; + + message Status { + // Quality gate status is only present for long living branch + optional string qualityGateStatus = 1; + // Merge bugs, vulnerabilities and codeSmell are only present for short living branch + optional int64 bugs = 2; + optional int64 vulnerabilities = 3; + optional int64 codeSmells = 4; + } + +} + + diff --git a/sonar-ws-generated/src/main/protobuf/ws-projectlink.proto b/sonar-ws-generated/src/main/protobuf/ws-projectlink.proto new file mode 100644 index 00000000000..613f6b633cc --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-projectlink.proto @@ -0,0 +1,23 @@ +syntax = "proto2"; + +package sonarqube.ws.projectlink; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectLinks"; +option optimize_for = SPEED; + +// WS api/project_links/list +message SearchWsResponse { + repeated Link links = 1; +} + +message CreateWsResponse { + optional Link link = 1; +} + +message Link { + optional string id = 1; + optional string name = 2; + optional string type = 3; + optional string url = 4; +} \ No newline at end of file diff --git a/sonar-ws-generated/src/main/protobuf/ws-projects.proto b/sonar-ws-generated/src/main/protobuf/ws-projects.proto new file mode 100644 index 00000000000..2f5372f1305 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-projects.proto @@ -0,0 +1,86 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projects; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Projects"; +option optimize_for = SPEED; + +message SearchMyProjectsWsResponse { + message Project { + optional string id = 1; + optional string key = 2; + optional string name = 4; + optional string description = 5; + optional string lastAnalysisDate = 6; + optional string qualityGate = 7; + repeated Link links = 8; + } + + message Link { + optional string name = 1; + optional string type = 2; + optional string href = 3; + } + + optional sonarqube.ws.commons.Paging paging = 1; + repeated Project projects = 2; +} + +message CreateWsResponse { + optional Project project = 1; + + message Project { + optional string key = 1; + optional string name = 2; + optional string qualifier = 3; + optional string visibility = 4; + } +} + +// WS api/projects/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; + + message Component { + optional string organization = 1; + optional string id = 2; + optional string key = 3; + optional string name = 4; + optional string qualifier = 5; + optional string visibility = 6; + optional string lastAnalysisDate = 7; + } +} + +// WS api/projects/prepare_bulk_update_key +message BulkUpdateKeyWsResponse { + repeated Key keys = 1; + + message Key { + optional string key = 1; + optional string newKey = 2; + optional bool duplicate = 3; + } +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-qualitygates.proto b/sonar-ws-generated/src/main/protobuf/ws-qualitygates.proto new file mode 100644 index 00000000000..c7d63b571ca --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-qualitygates.proto @@ -0,0 +1,122 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.qualitygate; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Qualitygates"; +option optimize_for = SPEED; + +// GET api/qualitygates/project_status +message ProjectStatusWsResponse { + optional ProjectStatus projectStatus = 1; + + message ProjectStatus { + optional Status status = 1; + repeated Condition conditions = 2; + repeated Period periods = 3; + optional bool ignoredConditions = 4; + } + + message Condition { + optional Status status = 1; + optional string metricKey = 2; + optional Comparator comparator = 3; + optional int32 periodIndex = 4; + optional string warningThreshold = 5; + optional string errorThreshold = 6; + optional string actualValue = 7; + } + + message Period { + optional int32 index = 1; + optional string mode = 2; + optional string date = 3; + optional string parameter = 4; + } + + enum Status { + OK = 1; + WARN = 2; + ERROR = 3; + NONE = 4; + } + + enum Comparator { + GT = 1; + LT = 2; + EQ = 3; + NE = 4; + } +} + +// GET api/qualitygates/get_by_project +message GetByProjectWsResponse { + optional QualityGate qualityGate = 1; +} + +message QualityGate { + optional string id = 1; + optional string name = 2; + optional bool default = 3; +} + +// GET api/qualitygates/app +message AppWsResponse { + optional bool edit = 1; + repeated Metric metrics = 3; + + message Metric { + optional string key = 1; + optional string name = 2; + optional string type = 3; + optional string domain = 4; + optional bool hidden = 5; + } +} + +// POST api/qualitygates/create +message CreateWsResponse { + optional int64 id = 1; + optional string name = 2; +} + +// POST api/qualitygates/create_condition +message CreateConditionWsResponse { + optional int64 id = 1; + optional string metric = 2; + optional string op = 3; + optional string warning = 4; + optional string error = 5; + optional int32 period = 6; +} + +// POST api/qualitygates/update_condition +message UpdateConditionWsResponse { + optional int64 id = 1; + optional string metric = 2; + optional string op = 3; + optional string warning = 4; + optional string error = 5; + optional int32 period = 6; +} + + + diff --git a/sonar-ws-generated/src/main/protobuf/ws-qualityprofiles.proto b/sonar-ws-generated/src/main/protobuf/ws-qualityprofiles.proto new file mode 100644 index 00000000000..e4d9df36abc --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-qualityprofiles.proto @@ -0,0 +1,169 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.qualityprofiles; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Qualityprofiles"; +option optimize_for = SPEED; + +// WS api/qualityprofiles/search +message SearchWsResponse { + repeated QualityProfile profiles = 1; + optional Actions actions = 2; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional string parentKey = 6; + optional string parentName = 7; + optional bool isDefault = 8; + optional int64 activeRuleCount = 9; + optional int64 activeDeprecatedRuleCount = 12; + optional int64 projectCount = 10; + optional string rulesUpdatedAt = 11; + optional string lastUsed = 13; + optional string userUpdatedAt = 14; + optional string organization = 15; + optional bool isBuiltIn = 16; + optional Actions actions = 17; + + message Actions { + optional bool edit = 1; + optional bool setAsDefault = 2; + optional bool copy = 3; + } + } + + message Actions { + optional bool create = 1; + } +} + +// WS api/qualityprofiles/create +message CreateWsResponse { + optional QualityProfile profile = 1; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional bool isDefault = 6; + optional Infos infos = 7; + optional Warnings warnings = 8; + optional string organization = 9; + + message Infos { + repeated string infos = 1; + } + + message Warnings { + repeated string warnings = 1; + } + } +} + +// WS api/qualityprofiles/inheritance +message InheritanceWsResponse { + optional QualityProfile profile = 1; + repeated QualityProfile ancestors = 2; + repeated QualityProfile children = 3; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string parent = 3; + optional int64 activeRuleCount = 4; + optional int64 overridingRuleCount = 5; + optional bool isBuiltIn = 6; + } +} + +// WS api/qualityprofiles/copy +message CopyWsResponse { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isDefault = 5; + optional bool isInherited = 6; + optional string parentKey = 7; +} + +// WS api/qualityprofiles/show +message ShowResponse { + optional QualityProfile profile = 1; + optional CompareToSonarWay compareToSonarWay = 2; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional bool isDefault = 6; + optional int64 activeRuleCount = 7; + optional int64 activeDeprecatedRuleCount = 8; + optional int64 projectCount = 9; + optional string rulesUpdatedAt = 10; + optional string lastUsed = 11; + optional string userUpdatedAt = 12; + optional string organization = 13; + optional bool isBuiltIn = 14; + } + + message CompareToSonarWay { + optional string profile = 1; + optional string profileName = 2; + optional int64 missingRuleCount = 3; + } +} + +// WS api/qualityprofiles/search_users +message SearchUsersResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; + + message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional bool selected = 4; + } +} + +// WS api/qualityprofiles/search_groups +message SearchGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; + + message Group { + optional string name = 1; + optional string description = 2; + optional bool selected = 3; + } +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-root.proto b/sonar-ws-generated/src/main/protobuf/ws-root.proto new file mode 100644 index 00000000000..c80ecfb270f --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-root.proto @@ -0,0 +1,36 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.root; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Root"; +option optimize_for = SPEED; + +// WS api/root/search +message SearchWsResponse { + repeated RootContent roots = 1; +} + +message RootContent { + optional string login = 1; + optional string name = 2; + optional string email = 3; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-rules.proto b/sonar-ws-generated/src/main/protobuf/ws-rules.proto new file mode 100644 index 00000000000..d3dfe2cd826 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-rules.proto @@ -0,0 +1,177 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.rules; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Rules"; +option optimize_for = SPEED; + +// WS api/rules/list for internal use only +message ListResponse { + + message Rule { + optional string repository = 1; + optional string key = 2; + optional string internal_key = 3; + optional string name = 4; + } + + repeated Rule rules = 1; +} + +// WS api/rules/search +message SearchResponse { + optional int64 total = 1; + optional int32 p = 2; + optional int64 ps = 3; + repeated Rule rules = 4; + optional Actives actives = 5; + optional QProfiles qProfiles = 6; + optional sonarqube.ws.commons.Facets facets = 7; +} + +//WS api/rules/show +message ShowResponse { + optional Rule rule = 1; + repeated Active actives = 3; +} + +//WS api/rules/create +message CreateResponse { + optional Rule rule = 1; +} + +//WS api/rules/update +message UpdateResponse { + optional Rule rule = 1; +} + +message Rule { + optional string key = 1; + optional string repo = 2; + optional string name = 3; + optional string createdAt = 4; + optional string htmlDesc = 5; + optional string htmlNote = 6; + optional string mdDesc = 7; + optional string mdNote = 8; + optional string noteLogin = 9; + optional string severity = 10; + optional sonarqube.ws.commons.RuleStatus status = 11; + optional string internalKey = 12; + optional bool isTemplate = 13; + optional string templateKey = 14; + optional Tags tags = 15; + optional SysTags sysTags = 16; + optional string lang = 19; + optional string langName = 20; + optional Params params = 21; + // characteristic fields, unsupported since 5.5 + optional string unusedDefaultDebtChar = 23; + optional string unusedDefaultDebtSubChar = 24; + optional string unusedDebtChar = 25; + optional string unusedDebtSubChar = 26; + optional string unusedDebtCharName = 27; + optional string unusedDebtSubCharName = 28; + + // Deprecated since 5.5, replaced by defaultRemFnType + optional string defaultDebtRemFnType = 29; + // Deprecated since 5.5, replaced by defaultRemFnGapMultiplier + optional string defaultDebtRemFnCoeff = 30; + // Deprecated since 5.5, replaced by defaultRemFnBaseEffort + optional string defaultDebtRemFnOffset = 31; + // Deprecated since 5.5, replaced by gapDescription + optional string effortToFixDescription = 32; + // Deprecated since 5.5, replaced by remFnOverloaded + optional bool debtOverloaded = 33; + // Deprecated since 5.5, replaced by remFnType + optional string debtRemFnType = 34; + // Deprecated since 5.5, replaced by remFnGapMultiplier + optional string debtRemFnCoeff = 35; + // Deprecated since 5.5, replaced by remFnBaseEffort + optional string debtRemFnOffset = 36; + + optional string defaultRemFnType = 38; + optional string defaultRemFnGapMultiplier = 39; + optional string defaultRemFnBaseEffort = 40; + optional string remFnType = 41; + optional string remFnGapMultiplier = 42; + optional string remFnBaseEffort = 43; + optional bool remFnOverloaded = 45; + optional string gapDescription = 44; + + optional sonarqube.ws.commons.RuleType type = 37; + + message Params { + repeated Param params = 1; + } + + message Param { + optional string key = 1; + optional string htmlDesc = 2; + optional string defaultValue = 3; + optional string type = 4; + } +} + +message SysTags { + repeated string sysTags = 1; +} + +message Tags { + repeated string tags = 1; +} + +message Actives { + map actives = 1; +} + +message ActiveList { + repeated Active activeList = 1; +} + +message Active { + optional string qProfile = 1; + optional string inherit = 2; + optional string severity = 3; + // Unused since 5.6, it has been removed because it was never used and costly to compute + optional string unusedParent = 4; + repeated Param params = 5; + optional string createdAt = 6; + + message Param { + optional string key = 1; + optional string value = 2; + } +} + +message QProfiles { + map qProfiles = 1; +} + +message QProfile { + optional string name = 1; + optional string lang = 2; + optional string langName = 3; + optional string parent = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-settings.proto b/sonar-ws-generated/src/main/protobuf/ws-settings.proto new file mode 100644 index 00000000000..db185b54446 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-settings.proto @@ -0,0 +1,119 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.settings; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Settings"; +option optimize_for = SPEED; + +// Response of GET api/settings/list_definitions +message ListDefinitionsWsResponse { + repeated Definition definitions = 1; +} + +// Response of GET api/settings/encrypt +message EncryptWsResponse { + string encryptedValue = 1; +} + +// Response of GET api/settings/generate_secret_key +message GenerateSecretKeyWsResponse { + string secretKey = 1; +} + +// Response of GET api/settings/check_secret_key +message CheckSecretKeyWsResponse { + bool secretKeyAvailable = 1; +} + +message Definition { + string key = 1; + oneof nameOneOf {string name = 2;} + string description = 3; + Type type = 4; + oneof categoryOneOf {string category = 5;} + oneof subCategoryOneOf {string subCategory = 6;} + oneof defaultValueOneOf {string defaultValue = 7;} + bool multiValues = 8; + repeated string options = 9; + repeated Field fields = 10; + oneof deprecatedKeyOneOf {string deprecatedKey = 11;} +} + +message Field { + string key = 1; + string name = 2; + string description = 3; + Type type = 4; + repeated string options = 5; +} + +enum Type { + STRING = 0; + TEXT = 1; + PASSWORD = 2; + BOOLEAN = 3; + INTEGER = 4; + FLOAT = 5; + LONG = 6; + REGULAR_EXPRESSION = 7; + METRIC = 8; + USER_LOGIN = 9; + METRIC_LEVEL = 10; + SINGLE_SELECT_LIST = 11; + PROPERTY_SET = 12; + LICENSE = 13; +} + +// Response of GET api/settings/values +message ValuesWsResponse { + repeated Setting settings = 1; +} + +message Setting { + string key = 1; + oneof valueOneOf { + string value = 2; + Values values = 3; + FieldValues fieldValues = 4; + } + bool inherited = 5; + oneof parentValueOneOf { + string parentValue = 6; + Values parentValues = 7; + FieldValues parentFieldValues = 8; + } +} + +message Values { + repeated string values = 1; +} + +message FieldValues { + repeated Value fieldValues = 1; + + message Value { + map value = 1; + } +} + + + diff --git a/sonar-ws-generated/src/main/protobuf/ws-system.proto b/sonar-ws-generated/src/main/protobuf/ws-system.proto new file mode 100644 index 00000000000..5ec419745d4 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-system.proto @@ -0,0 +1,77 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.system; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "System"; +option optimize_for = SPEED; + +// GET api/system/health +message HealthResponse { + optional Health health = 1; + repeated Cause causes = 2; + optional Nodes nodes = 3; +} + +message Nodes { + repeated Node nodes = 1; +} + +// GET api/system/status +message StatusResponse { + optional string id = 1; + optional string version = 2; + optional Status status = 3; +} + +message Cause { + optional string message = 1; +} + +enum Health { + GREEN = 0; + YELLOW = 1; + RED = 2; +} + +enum Status { + STARTING = 0; + UP = 1; + DOWN = 2; + RESTARTING = 3; + DB_MIGRATION_NEEDED = 4; + DB_MIGRATION_RUNNING = 5; +} + +message Node { + optional string name = 1; + optional NodeType type = 2; + optional string host = 3; + optional int32 port = 4; + optional string startedAt = 5; + optional Health health = 6; + repeated Cause causes = 7; +} + +enum NodeType { + APPLICATION = 0; + SEARCH = 1; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-tests.proto b/sonar-ws-generated/src/main/protobuf/ws-tests.proto new file mode 100644 index 00000000000..74865970ca6 --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-tests.proto @@ -0,0 +1,68 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.tests; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Tests"; +option optimize_for = SPEED; + +// WS api/tests/list +message ListResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Test tests = 2; +} + +// WS api/tests/covered_files +message CoveredFilesResponse { + repeated CoveredFile files = 1; + + message CoveredFile { + optional string id = 1; + optional string key = 2; + optional string longName = 3; + optional int32 coveredLines = 4; + optional string branch = 5; + } +} + + +message Test { + optional string id = 1; + optional string name = 2; + optional string fileId = 3; + optional string fileKey = 4; + optional string fileName = 5; + optional TestStatus status = 6; + optional int64 durationInMs = 7; + optional int32 coveredLines = 8; + optional string message = 9; + optional string stacktrace = 10; + optional string fileBranch = 11; +} + +enum TestStatus { + OK = 1; + FAILURE = 2; + ERROR = 3; + SKIPPED = 4; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-user_groups.proto b/sonar-ws-generated/src/main/protobuf/ws-user_groups.proto new file mode 100644 index 00000000000..07918617d9b --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-user_groups.proto @@ -0,0 +1,52 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.usergroup; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "UserGroups"; +option optimize_for = SPEED; + +// WS api/user_groups/create +message CreateWsResponse { + optional Group group = 1; +} + +// WS api/user_groups/update +message UpdateWsResponse { + optional Group group = 1; +} + +// WS api/user_groups/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; +} + +message Group { + optional int64 id = 1; + optional string organization = 2; + optional string name = 3; + optional string description = 4; + optional int32 membersCount = 5; + optional bool default = 6; +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-user_tokens.proto b/sonar-ws-generated/src/main/protobuf/ws-user_tokens.proto new file mode 100644 index 00000000000..e51cd80174c --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-user_tokens.proto @@ -0,0 +1,43 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.usertoken; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "UserTokens"; +option optimize_for = SPEED; + +// WS api/user_tokens/generate +message GenerateWsResponse { + optional string login = 1; + optional string name = 2; + optional string token = 3; +} + +// WS api/user_tokens/search +message SearchWsResponse { + optional string login = 1; + repeated UserToken userTokens = 2; + + message UserToken { + optional string name = 1; + optional string createdAt = 2; + } +} diff --git a/sonar-ws-generated/src/main/protobuf/ws-users.proto b/sonar-ws-generated/src/main/protobuf/ws-users.proto new file mode 100644 index 00000000000..474b2a870bf --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-users.proto @@ -0,0 +1,116 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.users; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Users"; +option optimize_for = SPEED; + +// WS api/users/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; + + message User { + optional string login = 1; + optional string name = 2; + optional bool active = 3; + optional string email = 4; + optional ScmAccounts scmAccounts = 5; + optional Groups groups = 6; + optional int32 tokensCount = 7; + optional bool local = 8; + optional string externalIdentity = 9; + optional string externalProvider = 10; + optional string avatar = 11; + } + + message Groups { + repeated string groups = 1; + } + + message ScmAccounts { + repeated string scmAccounts = 1; + } +} + +// WS api/users/identity_providers +message IdentityProvidersWsResponse { + repeated IdentityProvider identityProviders = 1; +} + +message IdentityProvider { + optional string key = 1; + optional string name = 2; + optional string iconPath = 3; + optional string backgroundColor = 4; +} + +message CreateWsResponse { + optional User user = 1; + + message User { + optional string login = 1; + optional string name = 2; + optional string email = 3; + repeated string scmAccounts = 4; + optional bool active = 5; + optional bool local = 6; + } +} + +// WS api/users/groups +message GroupsWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; + + message Group { + optional int64 id = 1; + optional string name = 2; + optional string description = 3; + optional bool selected = 4; + optional bool default = 5; + } +} + +// WS api/users/current +message CurrentWsResponse { + optional bool isLoggedIn = 1; + optional string login = 2; + optional string name = 3; + optional string email = 4; + optional bool local = 5; + optional string externalIdentity = 6; + optional string externalProvider = 7; + repeated string scmAccounts = 8; + repeated string groups = 9; + optional Permissions permissions = 10; + optional bool showOnboardingTutorial = 11; + optional string avatar = 12; + + message Permissions { + repeated string global = 1; + } +} + + diff --git a/sonar-ws-generated/src/main/protobuf/ws-webhooks.proto b/sonar-ws-generated/src/main/protobuf/ws-webhooks.proto new file mode 100644 index 00000000000..a7ef3a9ab2b --- /dev/null +++ b/sonar-ws-generated/src/main/protobuf/ws-webhooks.proto @@ -0,0 +1,49 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.webhooks; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Webhooks"; +option optimize_for = SPEED; + +// WS api/webhooks/deliveries +message DeliveriesWsResponse { + repeated Delivery deliveries = 1; +} + +// WS api/webhooks/delivery +message DeliveryWsResponse { + optional Delivery delivery = 1; +} + +message Delivery { + optional string id = 1; + optional string componentKey = 2; + optional string ceTaskId = 3; + optional string name = 4; + optional string url = 5; + optional string at = 6; + optional bool success = 7; + optional int32 httpStatus = 8; + optional int32 durationMs = 9; + optional string payload = 10; + optional string errorStacktrace = 11; +} diff --git a/sonar-ws/pom.xml b/sonar-ws/pom.xml index f735cdaa422..a56f2b27e78 100644 --- a/sonar-ws/pom.xml +++ b/sonar-ws/pom.xml @@ -39,6 +39,10 @@ commons-io commons-io + + org.sonarsource.sonarqube + sonar-ws-generated + org.sonarsource.sonarqube sonar-plugin-api diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java b/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java deleted file mode 100644 index 08783ca593e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; -import java.util.Locale; -import java.util.Map; -import org.apache.commons.io.FilenameUtils; - -/** - * @since 5.3 - */ -public final class MediaTypes { - - public static final String JSON = "application/json"; - public static final String XML = "application/xml"; - public static final String TXT = "text/plain"; - public static final String PROTOBUF = "application/x-protobuf"; - public static final String ZIP = "application/zip"; - public static final String JAVASCRIPT = "application/javascript"; - public static final String HTML = "text/html"; - public static final String DEFAULT = "application/octet-stream"; - - private static final Map MAP = new ImmutableMap.Builder() - .put("js", JAVASCRIPT) - .put("json", JSON) - .put("zip", "application/zip") - .put("tgz", "application/tgz") - .put("ps", "application/postscript") - .put("jnlp", "application/jnlp") - .put("jar", "application/java-archive") - .put("xls", "application/vnd.ms-excel") - .put("ppt", "application/vnd.ms-powerpoint") - .put("tar", "application/x-tar") - .put("xml", XML) - .put("dtd", "application/xml-dtd") - .put("xslt", "application/xslt+xml") - .put("bmp", "image/bmp") - .put("gif", "image/gif") - .put("jpg", "image/jpeg") - .put("jpeg", "image/jpeg") - .put("tiff", "image/tiff") - .put("png", "image/png") - .put("svg", "image/svg+xml") - .put("ico", "image/x-icon") - .put("txt", TXT) - .put("csv", "text/csv") - .put("properties", "text/plain") - .put("rtf", "text/rtf") - .put("html", HTML) - .put("css", "text/css") - .put("tsv", "text/tab-separated-values") - .build(); - - private MediaTypes() { - // only static methods - } - - public static String getByFilename(String filename) { - String extension = FilenameUtils.getExtension(filename); - String mime = null; - if (!Strings.isNullOrEmpty(extension)) { - mime = MAP.get(extension.toLowerCase(Locale.ENGLISH)); - } - return mime != null ? mime : DEFAULT; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java deleted file mode 100644 index 8b5fbcff005..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import com.google.common.collect.LinkedListMultimap; -import com.google.common.collect.ListMultimap; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonarqube.ws.MediaTypes; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Strings.isNullOrEmpty; -import static java.util.Collections.singletonList; -import static java.util.Collections.unmodifiableSet; -import static java.util.Objects.requireNonNull; - -abstract class BaseRequest implements WsRequest { - - private final String path; - - private String mediaType = MediaTypes.JSON; - - private final DefaultParameters parameters = new DefaultParameters(); - private final DefaultHeaders headers = new DefaultHeaders(); - - BaseRequest(String path) { - this.path = path; - } - - @Override - public String getPath() { - return path; - } - - @Override - public String getMediaType() { - return mediaType; - } - - /** - * Expected media type of response. Default is {@link MediaTypes#JSON}. - */ - public SELF setMediaType(String s) { - requireNonNull(s, "media type of response cannot be null"); - this.mediaType = s; - return (SELF) this; - } - - public SELF setParam(String key, @Nullable String value) { - return setSingleValueParam(key, value); - } - - public SELF setParam(String key, @Nullable Integer value) { - return setSingleValueParam(key, value); - } - - public SELF setParam(String key, @Nullable Long value) { - return setSingleValueParam(key, value); - } - - public SELF setParam(String key, @Nullable Float value) { - return setSingleValueParam(key, value); - } - - public SELF setParam(String key, @Nullable Boolean value) { - return setSingleValueParam(key, value); - } - - private SELF setSingleValueParam(String key, @Nullable Object value) { - checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); - if (value == null) { - return (SELF) this; - } - parameters.setValue(key, value.toString()); - - return (SELF) this; - } - - public SELF setParam(String key, @Nullable Collection values) { - checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); - if (values == null || values.isEmpty()) { - return (SELF) this; - } - - parameters.setValues(key, values.stream() - .filter(Objects::nonNull) - .map(Object::toString) - .filter(value -> !value.isEmpty()) - .collect(Collectors.toList())); - - return (SELF) this; - } - - @Override - public Map getParams() { - return parameters.keyValues.keySet().stream() - .collect(Collectors.toMap( - Function.identity(), - key -> parameters.keyValues.get(key).get(0), - (v1, v2) -> { - throw new IllegalStateException(String.format("Duplicate key '%s' in request", v1)); - }, - LinkedHashMap::new)); - } - - @Override - public Parameters getParameters() { - return parameters; - } - - @Override - public Headers getHeaders() { - return headers; - } - - public SELF setHeader(String name, @Nullable String value) { - requireNonNull(name, "Header name can't be null"); - headers.setValue(name, value); - return (SELF) this; - } - - private static class DefaultParameters implements Parameters { - // preserve insertion order - private final ListMultimap keyValues = LinkedListMultimap.create(); - - @Override - @CheckForNull - public String getValue(String key) { - return keyValues.containsKey(key) ? keyValues.get(key).get(0) : null; - } - - @Override - public List getValues(String key) { - return keyValues.get(key); - } - - @Override - public Set getKeys() { - return keyValues.keySet(); - } - - private DefaultParameters setValue(String key, String value) { - checkArgument(!isNullOrEmpty(key)); - checkArgument(value != null); - - keyValues.putAll(key, singletonList(value)); - return this; - } - - private DefaultParameters setValues(String key, Collection values) { - checkArgument(!isNullOrEmpty(key)); - checkArgument(values != null && !values.isEmpty()); - - this.keyValues.putAll(key, values.stream().map(Object::toString).filter(Objects::nonNull).collect(Collectors.toList())); - - return this; - } - } - - private static class DefaultHeaders implements Headers { - private final Map keyValues = new HashMap<>(); - - @Override - public Optional getValue(String name) { - return Optional.ofNullable(keyValues.get(name)); - } - - private DefaultHeaders setValue(String name, @Nullable String value) { - checkArgument(!isNullOrEmpty(name)); - - if (value == null) { - keyValues.remove(name); - } else { - keyValues.put(name, value); - } - return this; - } - - @Override - public Set getNames() { - return unmodifiableSet(keyValues.keySet()); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java deleted file mode 100644 index 039754f8571..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import static java.net.HttpURLConnection.HTTP_NO_CONTENT; - -abstract class BaseResponse implements WsResponse { - - @Override - public boolean isSuccessful() { - return code() >= 200 && code() < 300; - } - - @Override - public WsResponse failIfNotSuccessful() { - if (!isSuccessful()) { - String content = content(); - close(); - throw new HttpException(requestUrl(), code(), content); - } - return this; - } - - @Override - public boolean hasContent() { - return code() != HTTP_NO_CONTENT; - } - - @Override - public void close() { - // override if needed - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java deleted file mode 100644 index 4c6a0e9449e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import com.google.protobuf.Message; -import com.google.protobuf.Parser; -import java.io.InputStream; -import java.util.Collection; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.commons.io.IOUtils; -import org.sonarqube.ws.MediaTypes; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Strings.isNullOrEmpty; - -public abstract class BaseService { - - private final WsConnector wsConnector; - protected final String controller; - - public BaseService(WsConnector wsConnector, String controllerPath) { - checkArgument(!isNullOrEmpty(controllerPath)); - this.wsConnector = wsConnector; - this.controller = controllerPath; - } - - protected T call(BaseRequest request, Parser parser) { - request.setMediaType(MediaTypes.PROTOBUF); - WsResponse response = call(request); - return convert(response, parser); - } - - protected WsResponse call(WsRequest request) { - return wsConnector.call(request).failIfNotSuccessful(); - } - - public T convert(WsResponse response, Parser parser) { - try (InputStream byteStream = response.contentStream()) { - byte[] bytes = IOUtils.toByteArray(byteStream); - // HTTP header "Content-Type" is not verified. It may be different than protobuf. - return parser.parseFrom(bytes); - } catch (Exception e) { - throw new IllegalStateException("Fail to parse protobuf response of " + response.requestUrl(), e); - } - } - - protected String path(String action) { - return String.format("%s/%s", controller, action); - } - - @CheckForNull - protected static String inlineMultipleParamValue(@Nullable Collection values) { - return values == null ? null : String.join(",", values); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java index f0d0e841f86..473ec80ad45 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java @@ -28,14 +28,14 @@ import org.sonarqube.ws.client.organization.OrganizationService; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; -import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; +import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; -import org.sonarqube.ws.client.qualitygate.QualityGatesService; +import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; -import org.sonarqube.ws.client.system.SystemService; +import org.sonarqube.ws.client.system.SystemServiceOld; import org.sonarqube.ws.client.user.UsersService; import org.sonarqube.ws.client.usergroup.UserGroupsService; import org.sonarqube.ws.client.usertoken.UserTokensService; @@ -59,9 +59,9 @@ class DefaultWsClient implements WsClient { private final UsersService usersService; private final UserGroupsService userGroupsService; private final UserTokensService userTokensService; - private final QualityGatesService qualityGatesService; + private final QualitygatesService qualityGatesService; private final MeasuresService measuresService; - private final SystemService systemService; + private final SystemServiceOld systemService; private final CeService ceService; private final RulesService rulesService; private final ProjectsService projectsService; @@ -70,7 +70,7 @@ class DefaultWsClient implements WsClient { private final RootsService rootsService; private final WebhooksService webhooksService; private final ProjectAnalysisService projectAnalysisService; - private final ProjectBranchesService projectBranchesService; + private final ProjectBranchesServiceOld projectBranchesService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; @@ -83,9 +83,9 @@ class DefaultWsClient implements WsClient { this.usersService = new UsersService(wsConnector); this.userGroupsService = new UserGroupsService(wsConnector); this.userTokensService = new UserTokensService(wsConnector); - this.qualityGatesService = new QualityGatesService(wsConnector); + this.qualityGatesService = new QualitygatesService(wsConnector); this.measuresService = new MeasuresService(wsConnector); - this.systemService = new SystemService(wsConnector); + this.systemService = new SystemServiceOld(wsConnector); this.ceService = new CeService(wsConnector); this.rulesService = new RulesService(wsConnector); this.projectsService = new ProjectsService(wsConnector); @@ -94,7 +94,7 @@ class DefaultWsClient implements WsClient { this.rootsService = new RootsService(wsConnector); this.webhooksService = new WebhooksService(wsConnector); this.projectAnalysisService = new ProjectAnalysisService(wsConnector); - this.projectBranchesService = new ProjectBranchesService(wsConnector); + this.projectBranchesService = new ProjectBranchesServiceOld(wsConnector); } @Override @@ -148,7 +148,7 @@ class DefaultWsClient implements WsClient { } @Override - public QualityGatesService qualityGates() { + public QualitygatesService qualityGates() { return qualityGatesService; } @@ -158,7 +158,7 @@ class DefaultWsClient implements WsClient { } @Override - public SystemService system() { + public SystemServiceOld system() { return systemService; } @@ -203,7 +203,7 @@ class DefaultWsClient implements WsClient { } @Override - public ProjectBranchesService projectBranches() { + public ProjectBranchesServiceOld projectBranches() { return projectBranchesService; } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java deleted file mode 100644 index 02a1f2ac32f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -/** - * @since 5.3 - */ -public class GetRequest extends BaseRequest { - public GetRequest(String path) { - super(path); - } - - @Override - public Method getMethod() { - return Method.GET; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java deleted file mode 100644 index b289789a1f2..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import java.util.Optional; -import java.util.Set; - -/** - * HTTP headers - * - * @since 6.6 - */ -public interface Headers { - - Optional getValue(String name); - - Set getNames(); - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java deleted file mode 100644 index d456faeb473..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -/** - * @since 5.3 - */ -public class HttpException extends RuntimeException { - - private final String url; - private final int code; - private final String content; - - public HttpException(String url, int code, String content) { - super(String.format("Error %d on %s : %s", code, url, content)); - this.url = url; - this.code = code; - this.content = content; - } - - public String content() { - return content; - } - - public String url() { - return url; - } - - /** - * @see java.net.HttpURLConnection constants - */ - public int code() { - return code; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java deleted file mode 100644 index ae692ab103f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import java.util.List; -import java.util.Set; -import javax.annotation.CheckForNull; - -public interface Parameters { - /** - * In the case of a multi value parameter, returns the first element - */ - @CheckForNull - String getValue(String key); - - List getValues(String key); - - Set getKeys(); -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java deleted file mode 100644 index 13cbdd5c996..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import java.io.File; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @since 5.3 - */ -public class PostRequest extends BaseRequest { - - private final Map parts = new LinkedHashMap<>(); - - public PostRequest(String path) { - super(path); - } - - @Override - public Method getMethod() { - return Method.POST; - } - - public PostRequest setPart(String name, Part part) { - this.parts.put(name, part); - return this; - } - - public Map getParts() { - return parts; - } - - public static class Part { - private final String mediaType; - private final File file; - - public Part(String mediaType, File file) { - this.mediaType = mediaType; - this.file = file; - } - - public String getMediaType() { - return mediaType; - } - - public File getFile() { - return file; - } - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java index 6083afd01d4..71b00aa96d9 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java @@ -28,14 +28,14 @@ import org.sonarqube.ws.client.organization.OrganizationService; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; -import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; +import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; -import org.sonarqube.ws.client.qualitygate.QualityGatesService; +import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; -import org.sonarqube.ws.client.system.SystemService; +import org.sonarqube.ws.client.system.SystemServiceOld; import org.sonarqube.ws.client.user.UsersService; import org.sonarqube.ws.client.usergroup.UserGroupsService; import org.sonarqube.ws.client.usertoken.UserTokensService; @@ -78,11 +78,11 @@ public interface WsClient { UserTokensService userTokens(); - QualityGatesService qualityGates(); + QualitygatesService qualityGates(); MeasuresService measures(); - SystemService system(); + SystemServiceOld system(); CeService ce(); @@ -123,5 +123,5 @@ public interface WsClient { /** * @since 6.6> */ - ProjectBranchesService projectBranches(); + ProjectBranchesServiceOld projectBranches(); } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java deleted file mode 100644 index b203d18be98..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -/** - * @since 5.3 - */ -public interface WsConnector { - - /** - * Server base URL, always with trailing slash, for instance "http://localhost:9000/" - */ - String baseUrl(); - - /** - * @throws IllegalStateException if the request could not be executed due to - * a connectivity problem or timeout. Because networks can - * fail during an exchange, it is possible that the remote server - * accepted the request before the failure - */ - WsResponse call(WsRequest wsRequest); - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java deleted file mode 100644 index 9907ae7b39e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import java.util.Map; - -/** - * @since 5.3 - */ -public interface WsRequest { - - Method getMethod(); - - String getPath(); - - String getMediaType(); - - /** - * - * In case of multi value parameters, returns the first value - * - * @deprecated since 6.1. Use {@link #getParameters()} instead - */ - @Deprecated - Map getParams(); - - Parameters getParameters(); - - Headers getHeaders(); - - enum Method { - GET, POST - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java deleted file mode 100644 index fcaed89123f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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; - -import java.io.Closeable; -import java.io.InputStream; -import java.io.Reader; - -/** - * @since 5.3 - */ -public interface WsResponse extends Closeable { - - /** - * The absolute requested URL - */ - String requestUrl(); - - /** - * HTTP status code - */ - int code(); - - /** - * Returns true if the code is in [200..300), which means the request was - * successfully received, understood, and accepted. - */ - boolean isSuccessful() ; - - /** - * Throws a {@link HttpException} if {@link #isSuccessful()} is false. - */ - WsResponse failIfNotSuccessful(); - - String contentType(); - - boolean hasContent(); - - InputStream contentStream(); - - Reader contentReader(); - - String content(); - - @Override - void close(); - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java deleted file mode 100644 index 256afc5b0b5..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.ce; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class ActivityStatusWsRequest { - private final String componentId; - private final String componentKey; - - private ActivityStatusWsRequest(Builder builder) { - this.componentId = builder.componentId; - this.componentKey = builder.componentKey; - } - - @CheckForNull - public String getComponentId() { - return componentId; - } - - @CheckForNull - public String getComponentKey() { - return componentKey; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public static class Builder { - private String componentId; - private String componentKey; - - private Builder() { - // enforce newBuilder() use for instantiation - } - - public Builder setComponentId(@Nullable String componentId) { - this.componentId = componentId; - return this; - } - - public Builder setComponentKey(@Nullable String componentKey) { - this.componentKey = componentKey; - return this; - } - - public ActivityStatusWsRequest build() { - return new ActivityStatusWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityWsRequest.java deleted file mode 100644 index 8a1abb2817f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityWsRequest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.ce; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ActivityWsRequest { - private String componentId; - private String query; - private List status; - private String type; - private Boolean onlyCurrents; - private String minSubmittedAt; - private String maxExecutedAt; - private Integer page; - private Integer pageSize; - - @CheckForNull - public String getComponentId() { - return componentId; - } - - public ActivityWsRequest setComponentId(@Nullable String componentId) { - this.componentId = componentId; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public ActivityWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public List getStatus() { - return status; - } - - public ActivityWsRequest setStatus(@Nullable List status) { - this.status = status; - return this; - } - - @CheckForNull - public String getType() { - return type; - } - - public ActivityWsRequest setType(@Nullable String type) { - this.type = type; - return this; - } - - @CheckForNull - public Boolean getOnlyCurrents() { - return onlyCurrents; - } - - public ActivityWsRequest setOnlyCurrents(@Nullable Boolean onlyCurrents) { - this.onlyCurrents = onlyCurrents; - return this; - } - - @CheckForNull - public String getMinSubmittedAt() { - return minSubmittedAt; - } - - public ActivityWsRequest setMinSubmittedAt(@Nullable String minSubmittedAt) { - this.minSubmittedAt = minSubmittedAt; - return this; - } - - @CheckForNull - public String getMaxExecutedAt() { - return maxExecutedAt; - } - - public ActivityWsRequest setMaxExecutedAt(@Nullable String maxExecutedAt) { - this.maxExecutedAt = maxExecutedAt; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public ActivityWsRequest setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public ActivityWsRequest setPageSize(@Nullable Integer pageSize) { - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java deleted file mode 100644 index 243af50e8b7..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.ce; - -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsCe.ActivityResponse; -import org.sonarqube.ws.WsCe.ProjectResponse; -import org.sonarqube.ws.WsCe.TaskTypesWsResponse; -import org.sonarqube.ws.WsCe.WorkerCountResponse; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.WsConnector; - -import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT; -import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE; - -/** - * Maps web service {@code api/ce} (Compute Engine). - */ -public class CeService extends BaseService { - - public CeService(WsConnector wsConnector) { - super(wsConnector, "api/ce"); - } - - public ActivityResponse activity(ActivityWsRequest request) { - return call( - new GetRequest(path("activity")) - .setParam(PARAM_COMPONENT_ID, request.getComponentId()) - .setParam("q", request.getQuery()) - .setParam(PARAM_STATUS, inlineMultipleParamValue(request.getStatus())) - .setParam(PARAM_TYPE, request.getType()) - .setParam(PARAM_MAX_EXECUTED_AT, request.getMaxExecutedAt()) - .setParam(PARAM_MIN_SUBMITTED_AT, request.getMinSubmittedAt()) - .setParam(PARAM_ONLY_CURRENTS, request.getOnlyCurrents()) - .setParam("p", request.getPage()) - .setParam("ps", request.getPageSize()), - ActivityResponse.parser()); - } - - public TaskTypesWsResponse taskTypes() { - return call(new GetRequest(path("task_types")), TaskTypesWsResponse.parser()); - } - - /** - * Gets details of a Compute Engine task. - * - * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx. - * @since 5.5 - */ - public WsCe.TaskResponse task(String id) { - return task(TaskWsRequest.newBuilder(id).build()); - } - - public WsCe.TaskResponse task(TaskWsRequest taskWsRequest) { - GetRequest request = new GetRequest(path("task")) - .setParam("id", taskWsRequest.getTaskUuid()); - if (!taskWsRequest.getAdditionalFields().isEmpty()) { - request.setParam("additionalFields", inlineMultipleParamValue(taskWsRequest.getAdditionalFields())); - } - return call(request, WsCe.TaskResponse.parser()); - } - - public WsCe.ActivityStatusWsResponse activityStatus(ActivityStatusWsRequest request) { - return call( - new GetRequest(path("activity_status")) - .setParam(PARAM_COMPONENT_ID, request.getComponentId()) - .setParam(DEPRECATED_PARAM_COMPONENT_KEY, request.getComponentKey()), - WsCe.ActivityStatusWsResponse.parser()); - } - - public WorkerCountResponse workerCount() { - return call(new GetRequest(path(ACTION_WORKER_COUNT)), WorkerCountResponse.parser()); - } - - public ProjectResponse component(String componentKey) { - return call( - new GetRequest(path("component")) - .setParam(PARAM_COMPONENT, componentKey), - ProjectResponse.parser()); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskWsRequest.java deleted file mode 100644 index d8f93335354..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskWsRequest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.ce; - -import com.google.common.collect.ImmutableList; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class TaskWsRequest { - private final String taskUuid; - private final List additionalFields; - - private TaskWsRequest(Builder builder) { - this.taskUuid = builder.taskUuid; - this.additionalFields = createAdditionalFields(builder); - } - public static Builder newBuilder(String taskUuid) { - return new Builder(taskUuid); - } - - private static List createAdditionalFields(Builder builder) { - if (!builder.errorStacktrace && !builder.scannerContext) { - return Collections.emptyList(); - } - List res = new ArrayList<>(2); - if (builder.errorStacktrace) { - res.add("stacktrace"); - } - if (builder.scannerContext) { - res.add("scannerContext"); - } - return ImmutableList.copyOf(res); - } - - public String getTaskUuid() { - return taskUuid; - } - - public List getAdditionalFields() { - return additionalFields; - } - - public static final class Builder { - private final String taskUuid; - private boolean errorStacktrace = false; - private boolean scannerContext = false; - - private Builder(String taskUuid) { - this.taskUuid = taskUuid; - } - - public Builder withErrorStacktrace() { - this.errorStacktrace = true; - return this; - } - - public Builder withScannerContext() { - this.scannerContext = true; - return this; - } - - public TaskWsRequest build() { - return new TaskWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java index 95279bba0c6..6d45e829bf2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java @@ -22,10 +22,10 @@ package org.sonarqube.ws.client.component; import com.google.common.base.Joiner; import java.util.List; import java.util.stream.Collectors; -import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse; -import org.sonarqube.ws.WsComponents.SearchWsResponse; -import org.sonarqube.ws.WsComponents.ShowWsResponse; -import org.sonarqube.ws.WsComponents.TreeWsResponse; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.SearchWsResponse; +import org.sonarqube.ws.Components.ShowWsResponse; +import org.sonarqube.ws.Components.TreeWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsConnector; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java index db8b7e4bde2..0b0afb29cb0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java @@ -20,10 +20,10 @@ package org.sonarqube.ws.client.measure; import org.sonar.api.server.ws.WebService.Param; -import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse; -import org.sonarqube.ws.WsMeasures.ComponentWsResponse; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse; -import org.sonarqube.ws.WsMeasures.SearchWsResponse; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures.ComponentWsResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse; +import org.sonarqube.ws.Measures.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsConnector; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java index ba58f34a274..c0488373597 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java @@ -19,13 +19,13 @@ */ package org.sonarqube.ws.client.permission; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; -import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse; -import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse; -import org.sonarqube.ws.WsPermissions.UpdateTemplateWsResponse; -import org.sonarqube.ws.WsPermissions.UsersWsResponse; -import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.CreateTemplateWsResponse; +import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; +import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; +import org.sonarqube.ws.Permissions.UsersWsResponse; +import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; @@ -53,7 +53,7 @@ public class PermissionsService extends BaseService { super(wsConnector, PermissionsWsParameters.CONTROLLER); } - public WsPermissions.WsGroupsResponse groups(GroupsWsRequest request) { + public Permissions.WsGroupsResponse groups(GroupsWsRequest request) { GetRequest get = new GetRequest(path("groups")) .setParam(PARAM_PERMISSION, request.getPermission()) .setParam(PARAM_PROJECT_ID, request.getProjectId()) @@ -61,7 +61,7 @@ public class PermissionsService extends BaseService { .setParam("p", request.getPage()) .setParam("ps", request.getPageSize()) .setParam("q", request.getQuery()); - return call(get, WsPermissions.WsGroupsResponse.parser()); + return call(get, Permissions.WsGroupsResponse.parser()); } public void addGroup(AddGroupWsRequest request) { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java index 11dc0c4495f..9a42c155add 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java @@ -20,9 +20,9 @@ package org.sonarqube.ws.client.project; import com.google.common.base.Joiner; -import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; -import org.sonarqube.ws.WsProjects.CreateWsResponse; -import org.sonarqube.ws.WsProjects.SearchWsResponse; +import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; 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 deleted file mode 100644 index 75ad3bdaec7..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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 org.sonarqube.ws.WsBranches.ListWsResponse; -import org.sonarqube.ws.WsBranches.ShowWsResponse; -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 static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; - -public class ProjectBranchesService extends BaseService { - - public ProjectBranchesService(WsConnector wsConnector) { - super(wsConnector, CONTROLLER); - } - - public ListWsResponse list(String project) { - GetRequest get = new GetRequest(path(ACTION_LIST)) - .setParam(PARAM_PROJECT, project); - return call(get, ListWsResponse.parser()); - } - - public ShowWsResponse show(String project, String branch) { - GetRequest get = new GetRequest(path(ACTION_SHOW)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_BRANCH, branch); - return call(get, ShowWsResponse.parser()); - } - - public void delete(String project, String branch) { - PostRequest post = new PostRequest(path(ACTION_DELETE)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_BRANCH, branch); - call(post); - } - - public void rename(String project, String name) { - PostRequest post = new PostRequest(path(ACTION_RENAME)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_NAME, name); - call(post); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java new file mode 100644 index 00000000000..cee7e910636 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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 org.sonarqube.ws.ProjectBranches.ListWsResponse; +import org.sonarqube.ws.ProjectBranches.ShowWsResponse; +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 static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; + +public class ProjectBranchesServiceOld extends BaseService { + + public ProjectBranchesServiceOld(WsConnector wsConnector) { + super(wsConnector, CONTROLLER); + } + + public ListWsResponse list(String project) { + GetRequest get = new GetRequest(path(ACTION_LIST)) + .setParam(PARAM_PROJECT, project); + return call(get, ListWsResponse.parser()); + } + + public ShowWsResponse show(String project, String branch) { + GetRequest get = new GetRequest(path(ACTION_SHOW)) + .setParam(PARAM_PROJECT, project) + .setParam(PARAM_BRANCH, branch); + return call(get, ShowWsResponse.parser()); + } + + public void delete(String project, String branch) { + PostRequest post = new PostRequest(path(ACTION_DELETE)) + .setParam(PARAM_PROJECT, project) + .setParam(PARAM_BRANCH, branch); + call(post); + } + + public void rename(String project, String name) { + PostRequest post = new PostRequest(path(ACTION_RENAME)) + .setParam(PARAM_PROJECT, project) + .setParam(PARAM_NAME, name); + call(post); + } + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java index 82e37431572..148ff98162a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java @@ -21,3 +21,4 @@ package org.sonarqube.ws.client.projectbranches; import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java index 05d2e0d8a0b..6266aa38689 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java @@ -19,8 +19,8 @@ */ package org.sonarqube.ws.client.projectlinks; -import org.sonarqube.ws.WsProjectLinks.CreateWsResponse; -import org.sonarqube.ws.WsProjectLinks.SearchWsResponse; +import org.sonarqube.ws.ProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequest.java deleted file mode 100644 index 6165b8ec479..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Strings.isNullOrEmpty; - -@Immutable -public class CreateConditionRequest { - - private final long qualityGateId; - private final String metricKey; - private final String operator; - private final String warning; - private final String error; - private final Integer period; - - private CreateConditionRequest(Builder builder) { - this.qualityGateId = builder.qualityGateId; - this.metricKey = builder.metricKey; - this.operator = builder.operator; - this.warning = builder.warning; - this.error = builder.error; - this.period = builder.period; - } - - public long getQualityGateId() { - return qualityGateId; - } - - public String getMetricKey() { - return metricKey; - } - - public String getOperator() { - return operator; - } - - @CheckForNull - public String getWarning() { - return warning; - } - - @CheckForNull - public String getError() { - return error; - } - - @CheckForNull - public Integer getPeriod() { - return period; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private long qualityGateId; - private String metricKey; - private String operator; - private String warning; - private String error; - private Integer period; - - private Builder() { - // enforce factory method use - } - - public Builder setQualityGateId(long qualityGateId) { - this.qualityGateId = qualityGateId; - return this; - } - - public Builder setMetricKey(String metricKey) { - this.metricKey = metricKey; - return this; - } - - public Builder setOperator(String operator) { - this.operator = operator; - return this; - } - - public Builder setWarning(@Nullable String warning) { - this.warning = warning; - return this; - } - - public Builder setError(@Nullable String error) { - this.error = error; - return this; - } - - public Builder setPeriod(@Nullable Integer period) { - this.period = period; - return this; - } - - public CreateConditionRequest build() { - checkArgument(qualityGateId > 0, "Quality gate id is mandatory and must not be empty"); - checkArgument(!isNullOrEmpty(metricKey), "Metric key is mandatory and must not be empty"); - checkArgument(!isNullOrEmpty(operator), "Operator is mandatory and must not be empty"); - return new CreateConditionRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java deleted file mode 100644 index ba4c30014ae..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ProjectStatusWsRequest { - private String analysisId; - private String projectId; - private String projectKey; - - @CheckForNull - public String getAnalysisId() { - return analysisId; - } - - public ProjectStatusWsRequest setAnalysisId(@Nullable String analysisId) { - this.analysisId = analysisId; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public ProjectStatusWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public ProjectStatusWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java deleted file mode 100644 index 7872e153501..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse; -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 static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE_CONDITION; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_PROJECT_STATUS; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_SELECT; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_UPDATE_CONDITION; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; - -public class QualityGatesService extends BaseService { - - public QualityGatesService(WsConnector wsConnector) { - super(wsConnector, CONTROLLER_QUALITY_GATES); - } - - public ProjectStatusWsResponse projectStatus(ProjectStatusWsRequest request) { - return call(new GetRequest(path(ACTION_PROJECT_STATUS)) - .setParam(PARAM_ANALYSIS_ID, request.getAnalysisId()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()), - ProjectStatusWsResponse.parser()); - } - - public void associateProject(SelectWsRequest request) { - call(new PostRequest(path(ACTION_SELECT)) - .setParam(PARAM_GATE_ID, request.getGateId()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); - } - - public CreateWsResponse create(String name) { - return call(new PostRequest(path(ACTION_CREATE)) - .setParam(PARAM_NAME, name), - CreateWsResponse.parser()); - } - - public CreateConditionWsResponse createCondition(CreateConditionRequest request) { - return call(new PostRequest(path(ACTION_CREATE_CONDITION)) - .setParam(PARAM_GATE_ID, request.getQualityGateId()) - .setParam(PARAM_METRIC, request.getMetricKey()) - .setParam(PARAM_OPERATOR, request.getOperator()) - .setParam(PARAM_WARNING, request.getWarning()) - .setParam(PARAM_ERROR, request.getError()) - .setParam(PARAM_PERIOD, request.getPeriod()), - CreateConditionWsResponse.parser()); - } - - public UpdateConditionWsResponse updateCondition(UpdateConditionRequest request) { - return call(new PostRequest(path(ACTION_UPDATE_CONDITION)) - .setParam(PARAM_ID, request.getConditionId()) - .setParam(PARAM_METRIC, request.getMetricKey()) - .setParam(PARAM_OPERATOR, request.getOperator()) - .setParam(PARAM_WARNING, request.getWarning()) - .setParam(PARAM_ERROR, request.getError()) - .setParam(PARAM_PERIOD, request.getPeriod()), - UpdateConditionWsResponse.parser()); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java deleted file mode 100644 index a787caa6429..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import javax.annotation.CheckForNull; - -public class SelectWsRequest { - private long gateId; - private String projectId; - private String projectKey; - - public long getGateId() { - return gateId; - } - - public SelectWsRequest setGateId(long gateId) { - this.gateId = gateId; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public SelectWsRequest setProjectId(String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public SelectWsRequest setProjectKey(String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequest.java deleted file mode 100644 index 5afa9fd22f7..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Strings.isNullOrEmpty; - -@Immutable -public class UpdateConditionRequest { - - private final long conditionId; - private final String metricKey; - private final String operator; - private final String warning; - private final String error; - private final Integer period; - - private UpdateConditionRequest(Builder builder) { - this.conditionId = builder.conditionId; - this.metricKey = builder.metricKey; - this.operator = builder.operator; - this.warning = builder.warning; - this.error = builder.error; - this.period = builder.period; - } - - public long getConditionId() { - return conditionId; - } - - public String getMetricKey() { - return metricKey; - } - - public String getOperator() { - return operator; - } - - @CheckForNull - public String getWarning() { - return warning; - } - - @CheckForNull - public String getError() { - return error; - } - - @CheckForNull - public Integer getPeriod() { - return period; - } - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private long conditionId; - private String metricKey; - private String operator; - private String warning; - private String error; - private Integer period; - - private Builder() { - // enforce factory method use - } - - public Builder setConditionId(long conditionId) { - this.conditionId = conditionId; - return this; - } - - public Builder setMetricKey(String metricKey) { - this.metricKey = metricKey; - return this; - } - - public Builder setOperator(String operator) { - this.operator = operator; - return this; - } - - public Builder setWarning(@Nullable String warning) { - this.warning = warning; - return this; - } - - public Builder setError(@Nullable String error) { - this.error = error; - return this; - } - - public Builder setPeriod(@Nullable Integer period) { - this.period = period; - return this; - } - - public UpdateConditionRequest build() { - checkArgument(conditionId > 0, "Condition id is mandatory and must not be empty"); - checkArgument(!isNullOrEmpty(metricKey), "Metric key is mandatory and must not be empty"); - checkArgument(!isNullOrEmpty(operator), "Operator is mandatory and must not be empty"); - return new UpdateConditionRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java index 2364a1dae50..30d6141fa5d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java @@ -20,13 +20,13 @@ package org.sonarqube.ws.client.qualityprofile; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.CopyWsResponse; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse; -import org.sonarqube.ws.QualityProfiles.SearchUsersResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.CopyWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; @@ -118,7 +118,7 @@ public class QualityProfilesService extends BaseService { SearchWsResponse.parser()); } - public QualityProfiles.ShowResponse show(ShowRequest request) { + public Qualityprofiles.ShowResponse show(ShowRequest request) { return call( new GetRequest(path(ACTION_SHOW)) .setParam(PARAM_KEY, request.getKey()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java index 833df7ae5d0..43b06b8a3e0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/root/RootsService.java @@ -19,7 +19,7 @@ */ package org.sonarqube.ws.client.root; -import org.sonarqube.ws.WsRoot; +import org.sonarqube.ws.Root; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; @@ -30,8 +30,8 @@ public class RootsService extends BaseService { super(wsConnector, "api/roots"); } - public WsRoot.SearchWsResponse search() { - return call(new GetRequest(path("search")), WsRoot.SearchWsResponse.parser()); + public Root.SearchWsResponse search() { + return call(new GetRequest(path("search")), Root.SearchWsResponse.parser()); } public void setRoot(String login) { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java deleted file mode 100644 index 916072d2157..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.system; - -import org.sonarqube.ws.WsSystem; -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.client.WsResponse; - -public class SystemService extends BaseService { - public SystemService(WsConnector wsConnector) { - super(wsConnector, "api/system"); - } - - public WsSystem.HealthResponse health() { - return call(new GetRequest(path("health")), WsSystem.HealthResponse.parser()); - } - - public void restart() { - call(new PostRequest(path("restart"))); - } - - public WsSystem.StatusResponse status() { - return call(new GetRequest(path("status")), WsSystem.StatusResponse.parser()); - } - - public void changeLogLevel(String level) { - call(new PostRequest(path("change_log_level")).setParam("level", level)); - } - - public WsResponse info() { - return call(new GetRequest(path("info"))); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java new file mode 100644 index 00000000000..949cec119da --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java @@ -0,0 +1,53 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import org.sonarqube.ws.System; +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.client.WsResponse; + +public class SystemServiceOld extends BaseService { + public SystemServiceOld(WsConnector wsConnector) { + super(wsConnector, "api/system"); + } + + public System.HealthResponse health() { + return call(new GetRequest(path("health")), System.HealthResponse.parser()); + } + + public void restart() { + call(new PostRequest(path("restart"))); + } + + public System.StatusResponse status() { + return call(new GetRequest(path("status")), System.StatusResponse.parser()); + } + + public void changeLogLevel(String level) { + call(new PostRequest(path("change_log_level")).setParam("level", level)); + } + + public WsResponse info() { + return call(new GetRequest(path("info"))); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersService.java index c8151dc9133..9f2cb3f06a0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/user/UsersService.java @@ -20,10 +20,10 @@ package org.sonarqube.ws.client.user; import java.util.List; -import org.sonarqube.ws.WsUsers.CreateWsResponse; -import org.sonarqube.ws.WsUsers.CurrentWsResponse; -import org.sonarqube.ws.WsUsers.GroupsWsResponse; -import org.sonarqube.ws.WsUsers.SearchWsResponse; +import org.sonarqube.ws.Users.CreateWsResponse; +import org.sonarqube.ws.Users.CurrentWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse; +import org.sonarqube.ws.Users.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroup/UserGroupsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroup/UserGroupsService.java index 6851ea3d8da..9cd0a388db7 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroup/UserGroupsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroup/UserGroupsService.java @@ -28,9 +28,9 @@ import static org.sonar.api.server.ws.WebService.Param.FIELDS; import static org.sonar.api.server.ws.WebService.Param.PAGE; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; -import static org.sonarqube.ws.WsUserGroups.CreateWsResponse; -import static org.sonarqube.ws.WsUserGroups.SearchWsResponse; -import static org.sonarqube.ws.WsUserGroups.UpdateWsResponse; +import static org.sonarqube.ws.UserGroups.CreateWsResponse; +import static org.sonarqube.ws.UserGroups.SearchWsResponse; +import static org.sonarqube.ws.UserGroups.UpdateWsResponse; public class UserGroupsService extends BaseService { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java index 39fdf987ddb..d3cd30a8be1 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java @@ -19,8 +19,8 @@ */ package org.sonarqube.ws.client.usertoken; -import org.sonarqube.ws.WsUserTokens.GenerateWsResponse; -import org.sonarqube.ws.WsUserTokens.SearchWsResponse; +import org.sonarqube.ws.UserTokens.GenerateWsResponse; +import org.sonarqube.ws.UserTokens.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; diff --git a/sonar-ws/src/main/protobuf/ws-batch.proto b/sonar-ws/src/main/protobuf/ws-batch.proto deleted file mode 100644 index dec9005867d..00000000000 --- a/sonar-ws/src/main/protobuf/ws-batch.proto +++ /dev/null @@ -1,47 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.batch; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsBatch"; - -option optimize_for = SPEED; - -// WS batch/project -message WsProjectResponse { - optional int64 timestamp = 1; - map settingsByModule = 2; - map fileDataByModuleAndPath = 3; - optional int64 lastAnalysisDate = 4; - - message Settings { - map settings = 1; - } - - message FileDataByPath { - map FileDataByPath = 1; - } - - message FileData { - optional string hash = 1; - optional string revision = 2; - } -} diff --git a/sonar-ws/src/main/protobuf/ws-ce.proto b/sonar-ws/src/main/protobuf/ws-ce.proto deleted file mode 100644 index d5785806121..00000000000 --- a/sonar-ws/src/main/protobuf/ws-ce.proto +++ /dev/null @@ -1,103 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.ce; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsCe"; -option optimize_for = SPEED; - -// POST api/ce/submit -message SubmitResponse { - optional string taskId = 1; - optional string projectId = 2; -} - -// GET api/ce/task -message TaskResponse { - optional Task task = 1; -} - -// GET api/ce/activity -message ActivityResponse { - // paging has been deprecated in 5.5 - optional sonarqube.ws.commons.Paging unusedPaging = 1; - repeated Task tasks = 2; -} - -// GET api/ce/activity_status -message ActivityStatusWsResponse { - optional int32 pending = 1; - optional int32 failing = 2; - optional int32 inProgress = 3; -} - -// GET api/ce/component -message ProjectResponse { - repeated Task queue = 1; - optional Task current = 2; -} - -// GET api/ce/task_types -message TaskTypesWsResponse { - repeated string taskTypes = 1; -} - -// GET api/ce/worker_count -message WorkerCountResponse { - optional int32 value = 1; - optional bool canSetWorkerCount = 2; -} - -message Task { - optional string id = 1; - optional string type = 2; - optional string componentId = 3; - optional string componentKey = 4; - optional string componentName = 5; - optional string componentQualifier = 6; - optional string analysisId = 7; - optional TaskStatus status = 8; - optional string submittedAt = 9; - optional string submitterLogin = 10; - optional string startedAt = 11; - optional string executedAt = 12; - optional bool isLastExecuted = 13; - optional int64 executionTimeMs = 14; - optional bool logs = 15; - optional string errorMessage = 16; - optional string errorStacktrace = 17; - optional string scannerContext = 18; - optional bool hasScannerContext = 19; - optional string organization = 20; - optional string branch = 21; - optional sonarqube.ws.commons.BranchType branchType = 22; - optional string errorType = 23; -} - -enum TaskStatus { - PENDING = 0; - IN_PROGRESS = 1; - SUCCESS = 2; - FAILED = 3; - CANCELED = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-commons.proto b/sonar-ws/src/main/protobuf/ws-commons.proto deleted file mode 100644 index a9b566583e3..00000000000 --- a/sonar-ws/src/main/protobuf/ws-commons.proto +++ /dev/null @@ -1,124 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.commons; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Common"; -option optimize_for = SPEED; - -message Paging { - optional int32 pageIndex = 1; - optional int32 pageSize = 2; - optional int32 total = 3; -} - -message Facet { - // kind of key - optional string property = 1; - repeated FacetValue values = 2; -} - -message Facets { - repeated Facet facets = 1; -} - -message FacetValue { - optional string val = 1; - optional int64 count = 2; -} - -enum Severity { - INFO = 0; - MINOR = 1; - MAJOR = 2; - CRITICAL = 3; - BLOCKER = 4; -} - -message Rule { - optional string key = 1; - optional string name = 2; - optional string lang = 3; - optional RuleStatus status = 4; - optional string langName = 5; -} - -message Rules { - repeated Rule rules = 1; -} - -enum RuleStatus { - BETA = 0; - DEPRECATED = 1; - READY = 2; - REMOVED = 3; -} - -// Lines start at 1 and line offsets start at 0 -message TextRange { - // Start line. Should never be absent - optional int32 startLine = 1; - - // End line (inclusive). Absent means it is same as start line - optional int32 endLine = 2; - - // If absent it means range starts at the first offset of start line - optional int32 startOffset = 3; - - // If absent it means range ends at the last offset of end line - optional int32 endOffset = 4; -} - -message Metric { - optional string key = 1; - optional string name = 2; - optional string description = 3; - optional string domain = 4; - optional string type = 5; - optional bool higherValuesAreBetter = 6; - optional bool qualitative = 7; - optional bool hidden = 8; - optional bool custom = 9; - optional int32 decimalScale = 10; - optional string bestValue = 11; - optional string worstValue = 12; -} - -enum RuleType { - // Zero is required in order to not get MAINTAINABILITY as default value - // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ - UNKNOWN = 0; - - // same name as in Java enum IssueType, - // same index values as in database (see column ISSUES.ISSUE_TYPE) - CODE_SMELL = 1; - BUG = 2; - VULNERABILITY = 3; -} - -enum BranchType { - // Zero is required in order to not get LONG as default value - // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ - UNKNOWN_BRANCH_TYPE = 0; - - LONG = 1; - SHORT = 2; -} diff --git a/sonar-ws/src/main/protobuf/ws-components.proto b/sonar-ws/src/main/protobuf/ws-components.proto deleted file mode 100644 index 7b776586468..00000000000 --- a/sonar-ws/src/main/protobuf/ws-components.proto +++ /dev/null @@ -1,130 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.component; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsComponents"; -option optimize_for = SPEED; - -// WS api/components/search -message SearchWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Component components = 2; -} - -// WS api/components/tree -message TreeWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - optional Component baseComponent = 3; - repeated Component components = 4; -} - -// WS api/components/show -message ShowWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - optional Component component = 2; - repeated Component ancestors = 3; -} - -// WS api/components/suggestions -message SuggestionsWsResponse { - repeated Category results = 1; - optional string warning = 2; - repeated Organization organizations = 3; - repeated Project projects = 4; - - message Category { - optional string q = 1; - repeated Suggestion items = 2; - optional int64 more = 3; - } - - message Suggestion { - optional string key = 1; - optional string name = 2; - optional string match = 3; - optional string organization = 4; - optional string project = 5; - optional bool isRecentlyBrowsed = 6; - optional bool isFavorite = 7; - } - - message Organization { - optional string key = 1; - optional string name = 2; - } - - message Project { - optional string key = 1; - optional string name = 2; - } -} - -// WS api/components/search_projects -message SearchProjectsWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Component components = 2; - optional sonarqube.ws.commons.Facets facets = 3; -} - -// WS api/components/provisioned -message ProvisionedWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Component projects = 2; - - message Component { - optional string uuid = 1; - optional string key = 2; - optional string name = 3; - optional string creationDate = 4; - optional string visibility = 5; - } -} - -message Component { - optional string organization = 12; - optional string id = 1; - optional string key = 2; - optional string refId = 3; - optional string refKey = 4; - optional string projectId = 5; - optional string name = 6; - optional string description = 7; - optional string qualifier = 8; - optional string path = 9; - optional string language = 10; - optional bool isFavorite = 11; - optional string analysisDate = 13; - optional Tags tags = 14; - optional string visibility = 15; - optional string leakPeriodDate = 16; - // Root project key - optional string project = 17; - optional string branch = 18; - optional string version = 19; - - message Tags { - repeated string tags = 1; - } -} - diff --git a/sonar-ws/src/main/protobuf/ws-duplications.proto b/sonar-ws/src/main/protobuf/ws-duplications.proto deleted file mode 100644 index 50f72a22ffd..00000000000 --- a/sonar-ws/src/main/protobuf/ws-duplications.proto +++ /dev/null @@ -1,55 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto3"; - -package sonarqube.ws.duplication; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsDuplications"; -option optimize_for = SPEED; - -// WS api/duplications/show -message ShowResponse { - repeated Duplication duplications = 1; - map files = 2; - -} - -message Duplication { - repeated Block blocks = 1; -} - -message Block { - int32 from = 1; - int32 size = 2; - string _ref = 3; -} - -message File { - string key = 1; - string name = 2; - string uuid = 3; - string project = 4; - string projectUuid = 5; - string projectName = 6; - string subProject = 7; - string subProjectUuid = 8; - string subProjectName = 9; - string branch = 10; -} diff --git a/sonar-ws/src/main/protobuf/ws-editions.proto b/sonar-ws/src/main/protobuf/ws-editions.proto deleted file mode 100644 index e916bf39357..00000000000 --- a/sonar-ws/src/main/protobuf/ws-editions.proto +++ /dev/null @@ -1,60 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.editions; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsEditions"; -option optimize_for = SPEED; - -// GET api/editions/status -// POST api/editions/apply_license -message StatusResponse { - optional string currentEditionKey = 1; - optional InstallationStatus installationStatus = 2; - optional string nextEditionKey = 3; - optional string installError = 4; -} - -enum InstallationStatus { - NONE = 0; - AUTOMATIC_IN_PROGRESS = 1; - AUTOMATIC_READY = 2; - MANUAL_IN_PROGRESS = 3; - UNINSTALL_IN_PROGRESS = 4; -} - -// POST api/editions/preview -message PreviewResponse { - optional string nextEditionKey = 1; - optional PreviewStatus previewStatus = 2; -} - -enum PreviewStatus { - NO_INSTALL = 0; - AUTOMATIC_INSTALL = 1; - MANUAL_INSTALL = 2; -} - -// POST api/editions/form_data -message FormDataResponse { - optional string serverId = 1; - optional int64 ncloc = 2; -} diff --git a/sonar-ws/src/main/protobuf/ws-favorites.proto b/sonar-ws/src/main/protobuf/ws-favorites.proto deleted file mode 100644 index 7cdb6eceb94..00000000000 --- a/sonar-ws/src/main/protobuf/ws-favorites.proto +++ /dev/null @@ -1,40 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.favorite; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Favorites"; -option optimize_for = SPEED; - -// WS api/favorites/search -message SearchResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Favorite favorites = 2; -} - -message Favorite { - optional string organization = 4; - optional string key = 1; - optional string name = 2; - optional string qualifier = 3; -} diff --git a/sonar-ws/src/main/protobuf/ws-issues.proto b/sonar-ws/src/main/protobuf/ws-issues.proto deleted file mode 100644 index a1309679f58..00000000000 --- a/sonar-ws/src/main/protobuf/ws-issues.proto +++ /dev/null @@ -1,232 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.issues; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Issues"; -option optimize_for = SPEED; - -// Response of GET api/issues/search -message SearchWsResponse { - optional int64 total = 1; - optional int64 p = 2; - optional int32 ps = 3; - optional sonarqube.ws.commons.Paging paging = 4; - - // Total amount of effort, only when the facet "total" is enabled - optional int64 effortTotal = 13; - // Deprecated since 5.5, replaced by effortTotal - optional int64 debtTotal = 5; - - repeated Issue issues = 6; - repeated Component components = 7; - optional sonarqube.ws.commons.Rules rules = 8; - optional Users users = 9; - - // Deprecated since 5.5, action plan has been removed - optional ActionPlans unusedActionPlans = 10; - optional Languages languages = 11; - optional sonarqube.ws.commons.Facets facets = 12; -} - -// Response of most of POST/issues/{operation}, for instance assign, add_comment and set_severity -message Operation { - optional Issue issue = 1; - repeated Component components = 2; - repeated sonarqube.ws.commons.Rule rules = 3; - repeated Users.User users = 4; - // Deprecated since 5.5, action plan has been removed - repeated ActionPlan unusedActionPlans = 5; -} - -message Issue { - optional string key = 1; - optional string rule = 2; - optional sonarqube.ws.commons.Severity severity = 3; - optional string component = 4; - optional int64 unusedComponentId = 5; - optional string project = 6; - optional string subProject = 7; - optional int32 line = 8; - optional string hash = 31; - optional sonarqube.ws.commons.TextRange textRange = 9; - repeated Flow flows = 10; - optional string resolution = 11; - optional string status = 12; - optional string message = 13; - - optional string effort = 28; - // Deprecated since 5.5, replaced by effort - optional string debt = 14; - - optional string assignee = 15; - - // Unused since 5.5, manual issues feature has been removed - optional string unusedReporter = 16; - - // SCM login of the committer who introduced the issue - optional string author = 17; - - // Deprecated since 5.5, action plan has been removed - optional string actionPlan = 18; - - repeated string tags = 19; - - // the transitions allowed for the requesting user. - optional Transitions transitions = 20; - - // the actions allowed for the requesting user. - optional Actions actions = 21; - - optional Comments comments = 22; - optional string creationDate = 23; - optional string updateDate = 24; - optional string fUpdateAge = 25; - optional string closeDate = 26; - - optional sonarqube.ws.commons.RuleType type = 27; - - optional string organization = 29; - optional string branch = 30; -} - -message Transitions { - repeated string transitions = 1; -} - -message Actions { - repeated string actions = 1; -} - -message Flow { - repeated Location locations = 1; -} - -message Location { - optional string unusedComponentId = 1; - // Only when component is a file. Can be empty for a file if this is an issue global to the file. - optional sonarqube.ws.commons.TextRange textRange = 2; - optional string msg = 3; -} - -message Comment { - optional string key = 1; - optional string login = 2; - // TODO drop, it's already in field "users" - optional string email = 3; - // TODO drop, it's already in field "users" - optional string userName = 4; - optional string htmlText = 5; - // TODO rename markdownText ? - optional string markdown = 6; - optional bool updatable = 7; - optional string createdAt = 8; -} - -message Comments { - repeated Comment comments = 1; -} - -// Deprecated since 5.5 -message ActionPlan { - optional string key = 1; - optional string name = 2; - - // TODO define enum - optional string status = 3; - optional string deadLine = 4; - // TODO to be renamed, is it id or key ? - optional string project = 5; -} - -// Deprecated since 5.5 -message ActionPlans { - repeated ActionPlan actionPlans = 1; -} - -message Language { - optional string key = 1; - optional string name = 2; -} - -message Languages { - repeated Language languages = 1; -} - -message Component { - optional string organization = 11; - optional int64 deprecatedId = 1; - optional string key = 2; - optional string uuid = 3; - optional bool enabled = 4; - optional string qualifier = 5; - optional string name = 6; - optional string longName = 7; - optional string path = 8; - optional int64 unusedProjectId = 9; - optional int64 unusedSubProjectId = 10; - optional string branch = 12; -} - -// Response of GET api/issues/changelog -message ChangelogWsResponse { - repeated Changelog changelog = 1; - - message Changelog { - optional string user = 1; - optional string userName = 2; - // Email is no more returned since 6.3 - optional string deprecatedEmail = 3; - optional string creationDate = 4; - repeated Diff diffs = 5; - optional string avatar = 6; - - message Diff { - optional string key = 1; - optional string newValue = 2; - optional string oldValue = 3; - } - } -} - -// Response of POST api/issues/bulk_change -message BulkChangeWsResponse { - optional int64 total = 1; - optional int64 success = 2; - optional int64 ignored = 3; - optional int64 failures = 4; -} - -message Users { - repeated User users = 1; - - message User { - optional string login = 1; - optional string name = 2; - optional string avatar = 3; - optional bool active = 4; - } -} - - - diff --git a/sonar-ws/src/main/protobuf/ws-measures.proto b/sonar-ws/src/main/protobuf/ws-measures.proto deleted file mode 100644 index 199184eda3b..00000000000 --- a/sonar-ws/src/main/protobuf/ws-measures.proto +++ /dev/null @@ -1,110 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.measures; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsMeasures"; -option optimize_for = SPEED; - -// WS api/measures/component_tree -message ComponentTreeWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - optional Component baseComponent = 2; - repeated Component components = 3; - optional Metrics metrics = 4; - optional Periods periods = 5; -} - -// WS api/measures/component -message ComponentWsResponse { - optional Component component = 1; - optional Metrics metrics = 2; - optional Periods periods = 3; -} - -// WS api/measures/search -message SearchWsResponse { - repeated Measure measures = 1; -} - -// WS api/measures/search_history -message SearchHistoryResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated HistoryMeasure measures = 2; - - message HistoryMeasure { - optional string metric = 1; - repeated HistoryValue history = 2; - } - - message HistoryValue { - optional string date = 1; - optional string value = 2; - } -} - -message Component { - optional string id = 1; - optional string key = 2; - optional string refId = 3; - optional string refKey = 4; - optional string projectId = 5; - optional string name = 6; - optional string description = 7; - optional string qualifier = 8; - optional string path = 9; - optional string language = 10; - repeated Measure measures = 11; - optional string branch = 12; -} - -message Period { - optional int32 index = 1; - optional string mode = 2; - optional string date = 3; - optional string parameter = 4; -} - -message Periods { - repeated Period periods = 1; -} - -message Metrics { - repeated sonarqube.ws.commons.Metric metrics = 1; -} - -message Measure { - optional string metric = 1; - optional string value = 2; - optional PeriodsValue periods = 3; - optional string component = 4; -} - -message PeriodsValue { - repeated PeriodValue periodsValue = 1; -} - -message PeriodValue { - optional int32 index = 1; - optional string value = 2; -} diff --git a/sonar-ws/src/main/protobuf/ws-notifications.proto b/sonar-ws/src/main/protobuf/ws-notifications.proto deleted file mode 100644 index ac0cb034748..00000000000 --- a/sonar-ws/src/main/protobuf/ws-notifications.proto +++ /dev/null @@ -1,41 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.notification; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Notifications"; -option optimize_for = SPEED; - -// WS api/notifications/list -message ListResponse { - repeated Notification notifications = 1; - repeated string channels = 2; - repeated string globalTypes = 3; - repeated string perProjectTypes = 4; -} - -message Notification { - optional string channel = 1; - optional string type = 2; - optional string organization = 5; - optional string project = 3; - optional string projectName = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-organizations.proto b/sonar-ws/src/main/protobuf/ws-organizations.proto deleted file mode 100644 index f6f2733c772..00000000000 --- a/sonar-ws/src/main/protobuf/ws-organizations.proto +++ /dev/null @@ -1,70 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.organizations; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Organizations"; -option optimize_for = SPEED; - -// WS api/organizations/create -message CreateWsResponse { - optional Organization organization = 1; -} - -// WS api/organizations/update -message UpdateWsResponse { - optional Organization organization = 1; -} - -// WS api/organizations/search -message SearchWsResponse { - repeated Organization organizations = 1; - optional sonarqube.ws.commons.Paging paging = 2; -} - -// WS api/organizations/search_members -message SearchMembersWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated User users = 2; -} - -// WS api/organizations/add_member -message AddMemberWsResponse { - optional User user = 1; -} - -message Organization { - optional string key = 1; - optional string name = 2; - optional string description = 3; - optional string url = 4; - optional string avatar = 5; - optional bool guarded = 6; -} - -message User { - optional string login = 1; - optional string name = 2; - optional string avatar = 3; - optional int32 groupCount = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-permissions.proto b/sonar-ws/src/main/protobuf/ws-permissions.proto deleted file mode 100644 index 6b6b1e2e501..00000000000 --- a/sonar-ws/src/main/protobuf/ws-permissions.proto +++ /dev/null @@ -1,138 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.permissions; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsPermissions"; -option optimize_for = SPEED; - -// WS api/permissions/template_users for internal use only -message OldUsersWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated OldUser users = 2; -} - -// WS api/permissions/users for internal use only -message UsersWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated User users = 2; -} - -// WS api/permissions/groups for internal use only -message WsGroupsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Group groups = 2; -} - -// WS api/permissions/template_groups for internal use only -message WsTemplateGroupsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated OldGroup groups = 2; -} - -message WsSearchGlobalPermissionsResponse { - repeated Permission permissions = 1; -} - -message SearchProjectPermissionsWsResponse { - message Project { - optional string id = 1; - optional string key = 2; - optional string qualifier = 3; - optional string name = 4; - repeated Permission permissions = 5; - } - - optional sonarqube.ws.commons.Paging paging = 1; - repeated Project projects = 2; - repeated Permission permissions = 3; -} - -message CreateTemplateWsResponse { - optional PermissionTemplate permissionTemplate = 1; -} - -message UpdateTemplateWsResponse { - optional PermissionTemplate permissionTemplate = 1; -} - -message SearchTemplatesWsResponse { - message TemplateIdQualifier { - optional string templateId = 1; - optional string qualifier = 2; - } - - repeated PermissionTemplate permissionTemplates = 1; - repeated TemplateIdQualifier defaultTemplates = 2; - repeated Permission permissions = 3; -} - -message Permission { - optional string key = 1; - optional string name = 2; - optional string description = 3; - optional int32 usersCount = 4; - optional int32 groupsCount = 5; - optional bool withProjectCreator = 6; -} - -message PermissionTemplate { - optional string id = 1; - optional string name = 2; - optional string description = 3; - optional string projectKeyPattern = 4; - // ex: 2015-08-25T16:18:48+0200 - optional string createdAt = 5; - // ex: 2015-08-25T16:18:48+0200 - optional string updatedAt = 6; - repeated Permission permissions = 7; -} - -message OldUser { - optional string login = 1; - optional string name = 2; - optional string email = 3; - optional bool selected = 4; -} - -message User { - optional string login = 1; - optional string name = 2; - optional string email = 3; - repeated string permissions = 4; - optional string avatar = 5; -} - -message OldGroup { - optional string id = 1; - optional string name = 2; - optional string description = 3; - optional bool selected = 4; -} - -message Group { - optional string id = 1; - optional string name = 2; - optional string description = 3; - repeated string permissions = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-project_tags.proto b/sonar-ws/src/main/protobuf/ws-project_tags.proto deleted file mode 100644 index 99cc43c2e10..00000000000 --- a/sonar-ws/src/main/protobuf/ws-project_tags.proto +++ /dev/null @@ -1,30 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto3"; - -package sonarqube.ws.projects; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsProjectTags"; -option optimize_for = SPEED; - -// Response for api/project_tags/search -message SearchResponse { - repeated string tags = 1; -} diff --git a/sonar-ws/src/main/protobuf/ws-projectanalyses.proto b/sonar-ws/src/main/protobuf/ws-projectanalyses.proto deleted file mode 100644 index 3b4ea562bb9..00000000000 --- a/sonar-ws/src/main/protobuf/ws-projectanalyses.proto +++ /dev/null @@ -1,57 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.projectanalysis; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "ProjectAnalyses"; -option optimize_for = SPEED; - -// WS api/project_analyses/create_event -message CreateEventResponse { - optional Event event = 1; -} - -// WS api/project_analyses/update_event -message UpdateEventResponse { - optional Event event = 1; -} - -// WS api/project_analyses/search -message SearchResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Analysis analyses = 2; -} - -message Event { - optional string key = 1; - optional string analysis = 2; - optional string category = 3; - optional string name = 4; - optional string description = 5; -} - -message Analysis { - optional string key = 1; - optional string date = 2; - repeated Event events = 3; -} diff --git a/sonar-ws/src/main/protobuf/ws-projectbranches.proto b/sonar-ws/src/main/protobuf/ws-projectbranches.proto deleted file mode 100644 index d4b2a183e4e..00000000000 --- a/sonar-ws/src/main/protobuf/ws-projectbranches.proto +++ /dev/null @@ -1,60 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.projectbranch; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsBranches"; -option optimize_for = SPEED; - -import "ws-commons.proto"; - -// WS api/project_branches/list -message ListWsResponse { - repeated Branch branches = 1; -} - -// WS api/project_branches/show -message ShowWsResponse { - optional Branch branch = 1; -} - -message Branch { - optional string name = 1; - optional bool isMain = 2; - optional sonarqube.ws.commons.BranchType type = 3; - // Merge branch is only present for short living branch - optional string mergeBranch = 4; - optional Status status = 5; - optional bool isOrphan = 6; - optional string analysisDate = 7; - - message Status { - // Quality gate status is only present for long living branch - optional string qualityGateStatus = 1; - // Merge bugs, vulnerabilities and codeSmell are only present for short living branch - optional int64 bugs = 2; - optional int64 vulnerabilities = 3; - optional int64 codeSmells = 4; - } - -} - - diff --git a/sonar-ws/src/main/protobuf/ws-projectlink.proto b/sonar-ws/src/main/protobuf/ws-projectlink.proto deleted file mode 100644 index 073b3e498b0..00000000000 --- a/sonar-ws/src/main/protobuf/ws-projectlink.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto2"; - -package sonarqube.ws.projectlink; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsProjectLinks"; -option optimize_for = SPEED; - -// WS api/project_links/list -message SearchWsResponse { - repeated Link links = 1; -} - -message CreateWsResponse { - optional Link link = 1; -} - -message Link { - optional string id = 1; - optional string name = 2; - optional string type = 3; - optional string url = 4; -} \ No newline at end of file diff --git a/sonar-ws/src/main/protobuf/ws-projects.proto b/sonar-ws/src/main/protobuf/ws-projects.proto deleted file mode 100644 index 8668ffc355a..00000000000 --- a/sonar-ws/src/main/protobuf/ws-projects.proto +++ /dev/null @@ -1,86 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.projects; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsProjects"; -option optimize_for = SPEED; - -message SearchMyProjectsWsResponse { - message Project { - optional string id = 1; - optional string key = 2; - optional string name = 4; - optional string description = 5; - optional string lastAnalysisDate = 6; - optional string qualityGate = 7; - repeated Link links = 8; - } - - message Link { - optional string name = 1; - optional string type = 2; - optional string href = 3; - } - - optional sonarqube.ws.commons.Paging paging = 1; - repeated Project projects = 2; -} - -message CreateWsResponse { - optional Project project = 1; - - message Project { - optional string key = 1; - optional string name = 2; - optional string qualifier = 3; - optional string visibility = 4; - } -} - -// WS api/projects/search -message SearchWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Component components = 2; - - message Component { - optional string organization = 1; - optional string id = 2; - optional string key = 3; - optional string name = 4; - optional string qualifier = 5; - optional string visibility = 6; - optional string lastAnalysisDate = 7; - } -} - -// WS api/projects/prepare_bulk_update_key -message BulkUpdateKeyWsResponse { - repeated Key keys = 1; - - message Key { - optional string key = 1; - optional string newKey = 2; - optional bool duplicate = 3; - } -} diff --git a/sonar-ws/src/main/protobuf/ws-qualitygates.proto b/sonar-ws/src/main/protobuf/ws-qualitygates.proto deleted file mode 100644 index 8444dbac729..00000000000 --- a/sonar-ws/src/main/protobuf/ws-qualitygates.proto +++ /dev/null @@ -1,122 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.qualitygate; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsQualityGates"; -option optimize_for = SPEED; - -// GET api/qualitygates/project_status -message ProjectStatusWsResponse { - optional ProjectStatus projectStatus = 1; - - message ProjectStatus { - optional Status status = 1; - repeated Condition conditions = 2; - repeated Period periods = 3; - optional bool ignoredConditions = 4; - } - - message Condition { - optional Status status = 1; - optional string metricKey = 2; - optional Comparator comparator = 3; - optional int32 periodIndex = 4; - optional string warningThreshold = 5; - optional string errorThreshold = 6; - optional string actualValue = 7; - } - - message Period { - optional int32 index = 1; - optional string mode = 2; - optional string date = 3; - optional string parameter = 4; - } - - enum Status { - OK = 1; - WARN = 2; - ERROR = 3; - NONE = 4; - } - - enum Comparator { - GT = 1; - LT = 2; - EQ = 3; - NE = 4; - } -} - -// GET api/qualitygates/get_by_project -message GetByProjectWsResponse { - optional QualityGate qualityGate = 1; -} - -message QualityGate { - optional string id = 1; - optional string name = 2; - optional bool default = 3; -} - -// GET api/qualitygates/app -message AppWsResponse { - optional bool edit = 1; - repeated Metric metrics = 3; - - message Metric { - optional string key = 1; - optional string name = 2; - optional string type = 3; - optional string domain = 4; - optional bool hidden = 5; - } -} - -// POST api/qualitygates/create -message CreateWsResponse { - optional int64 id = 1; - optional string name = 2; -} - -// POST api/qualitygates/create_condition -message CreateConditionWsResponse { - optional int64 id = 1; - optional string metric = 2; - optional string op = 3; - optional string warning = 4; - optional string error = 5; - optional int32 period = 6; -} - -// POST api/qualitygates/update_condition -message UpdateConditionWsResponse { - optional int64 id = 1; - optional string metric = 2; - optional string op = 3; - optional string warning = 4; - optional string error = 5; - optional int32 period = 6; -} - - - diff --git a/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto b/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto deleted file mode 100644 index ae1097dd5b5..00000000000 --- a/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto +++ /dev/null @@ -1,169 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.qualityprofiles; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "QualityProfiles"; -option optimize_for = SPEED; - -// WS api/qualityprofiles/search -message SearchWsResponse { - repeated QualityProfile profiles = 1; - optional Actions actions = 2; - - message QualityProfile { - optional string key = 1; - optional string name = 2; - optional string language = 3; - optional string languageName = 4; - optional bool isInherited = 5; - optional string parentKey = 6; - optional string parentName = 7; - optional bool isDefault = 8; - optional int64 activeRuleCount = 9; - optional int64 activeDeprecatedRuleCount = 12; - optional int64 projectCount = 10; - optional string rulesUpdatedAt = 11; - optional string lastUsed = 13; - optional string userUpdatedAt = 14; - optional string organization = 15; - optional bool isBuiltIn = 16; - optional Actions actions = 17; - - message Actions { - optional bool edit = 1; - optional bool setAsDefault = 2; - optional bool copy = 3; - } - } - - message Actions { - optional bool create = 1; - } -} - -// WS api/qualityprofiles/create -message CreateWsResponse { - optional QualityProfile profile = 1; - - message QualityProfile { - optional string key = 1; - optional string name = 2; - optional string language = 3; - optional string languageName = 4; - optional bool isInherited = 5; - optional bool isDefault = 6; - optional Infos infos = 7; - optional Warnings warnings = 8; - optional string organization = 9; - - message Infos { - repeated string infos = 1; - } - - message Warnings { - repeated string warnings = 1; - } - } -} - -// WS api/qualityprofiles/inheritance -message InheritanceWsResponse { - optional QualityProfile profile = 1; - repeated QualityProfile ancestors = 2; - repeated QualityProfile children = 3; - - message QualityProfile { - optional string key = 1; - optional string name = 2; - optional string parent = 3; - optional int64 activeRuleCount = 4; - optional int64 overridingRuleCount = 5; - optional bool isBuiltIn = 6; - } -} - -// WS api/qualityprofiles/copy -message CopyWsResponse { - optional string key = 1; - optional string name = 2; - optional string language = 3; - optional string languageName = 4; - optional bool isDefault = 5; - optional bool isInherited = 6; - optional string parentKey = 7; -} - -// WS api/qualityprofiles/show -message ShowResponse { - optional QualityProfile profile = 1; - optional CompareToSonarWay compareToSonarWay = 2; - - message QualityProfile { - optional string key = 1; - optional string name = 2; - optional string language = 3; - optional string languageName = 4; - optional bool isInherited = 5; - optional bool isDefault = 6; - optional int64 activeRuleCount = 7; - optional int64 activeDeprecatedRuleCount = 8; - optional int64 projectCount = 9; - optional string rulesUpdatedAt = 10; - optional string lastUsed = 11; - optional string userUpdatedAt = 12; - optional string organization = 13; - optional bool isBuiltIn = 14; - } - - message CompareToSonarWay { - optional string profile = 1; - optional string profileName = 2; - optional int64 missingRuleCount = 3; - } -} - -// WS api/qualityprofiles/search_users -message SearchUsersResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated User users = 2; - - message User { - optional string login = 1; - optional string name = 2; - optional string avatar = 3; - optional bool selected = 4; - } -} - -// WS api/qualityprofiles/search_groups -message SearchGroupsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Group groups = 2; - - message Group { - optional string name = 1; - optional string description = 2; - optional bool selected = 3; - } -} diff --git a/sonar-ws/src/main/protobuf/ws-root.proto b/sonar-ws/src/main/protobuf/ws-root.proto deleted file mode 100644 index 1501a70d793..00000000000 --- a/sonar-ws/src/main/protobuf/ws-root.proto +++ /dev/null @@ -1,36 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.root; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsRoot"; -option optimize_for = SPEED; - -// WS api/root/search -message SearchWsResponse { - repeated Root roots = 1; -} - -message Root { - optional string login = 1; - optional string name = 2; - optional string email = 3; -} diff --git a/sonar-ws/src/main/protobuf/ws-rules.proto b/sonar-ws/src/main/protobuf/ws-rules.proto deleted file mode 100644 index d3dfe2cd826..00000000000 --- a/sonar-ws/src/main/protobuf/ws-rules.proto +++ /dev/null @@ -1,177 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.rules; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Rules"; -option optimize_for = SPEED; - -// WS api/rules/list for internal use only -message ListResponse { - - message Rule { - optional string repository = 1; - optional string key = 2; - optional string internal_key = 3; - optional string name = 4; - } - - repeated Rule rules = 1; -} - -// WS api/rules/search -message SearchResponse { - optional int64 total = 1; - optional int32 p = 2; - optional int64 ps = 3; - repeated Rule rules = 4; - optional Actives actives = 5; - optional QProfiles qProfiles = 6; - optional sonarqube.ws.commons.Facets facets = 7; -} - -//WS api/rules/show -message ShowResponse { - optional Rule rule = 1; - repeated Active actives = 3; -} - -//WS api/rules/create -message CreateResponse { - optional Rule rule = 1; -} - -//WS api/rules/update -message UpdateResponse { - optional Rule rule = 1; -} - -message Rule { - optional string key = 1; - optional string repo = 2; - optional string name = 3; - optional string createdAt = 4; - optional string htmlDesc = 5; - optional string htmlNote = 6; - optional string mdDesc = 7; - optional string mdNote = 8; - optional string noteLogin = 9; - optional string severity = 10; - optional sonarqube.ws.commons.RuleStatus status = 11; - optional string internalKey = 12; - optional bool isTemplate = 13; - optional string templateKey = 14; - optional Tags tags = 15; - optional SysTags sysTags = 16; - optional string lang = 19; - optional string langName = 20; - optional Params params = 21; - // characteristic fields, unsupported since 5.5 - optional string unusedDefaultDebtChar = 23; - optional string unusedDefaultDebtSubChar = 24; - optional string unusedDebtChar = 25; - optional string unusedDebtSubChar = 26; - optional string unusedDebtCharName = 27; - optional string unusedDebtSubCharName = 28; - - // Deprecated since 5.5, replaced by defaultRemFnType - optional string defaultDebtRemFnType = 29; - // Deprecated since 5.5, replaced by defaultRemFnGapMultiplier - optional string defaultDebtRemFnCoeff = 30; - // Deprecated since 5.5, replaced by defaultRemFnBaseEffort - optional string defaultDebtRemFnOffset = 31; - // Deprecated since 5.5, replaced by gapDescription - optional string effortToFixDescription = 32; - // Deprecated since 5.5, replaced by remFnOverloaded - optional bool debtOverloaded = 33; - // Deprecated since 5.5, replaced by remFnType - optional string debtRemFnType = 34; - // Deprecated since 5.5, replaced by remFnGapMultiplier - optional string debtRemFnCoeff = 35; - // Deprecated since 5.5, replaced by remFnBaseEffort - optional string debtRemFnOffset = 36; - - optional string defaultRemFnType = 38; - optional string defaultRemFnGapMultiplier = 39; - optional string defaultRemFnBaseEffort = 40; - optional string remFnType = 41; - optional string remFnGapMultiplier = 42; - optional string remFnBaseEffort = 43; - optional bool remFnOverloaded = 45; - optional string gapDescription = 44; - - optional sonarqube.ws.commons.RuleType type = 37; - - message Params { - repeated Param params = 1; - } - - message Param { - optional string key = 1; - optional string htmlDesc = 2; - optional string defaultValue = 3; - optional string type = 4; - } -} - -message SysTags { - repeated string sysTags = 1; -} - -message Tags { - repeated string tags = 1; -} - -message Actives { - map actives = 1; -} - -message ActiveList { - repeated Active activeList = 1; -} - -message Active { - optional string qProfile = 1; - optional string inherit = 2; - optional string severity = 3; - // Unused since 5.6, it has been removed because it was never used and costly to compute - optional string unusedParent = 4; - repeated Param params = 5; - optional string createdAt = 6; - - message Param { - optional string key = 1; - optional string value = 2; - } -} - -message QProfiles { - map qProfiles = 1; -} - -message QProfile { - optional string name = 1; - optional string lang = 2; - optional string langName = 3; - optional string parent = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-settings.proto b/sonar-ws/src/main/protobuf/ws-settings.proto deleted file mode 100644 index db185b54446..00000000000 --- a/sonar-ws/src/main/protobuf/ws-settings.proto +++ /dev/null @@ -1,119 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto3"; - -package sonarqube.ws.settings; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Settings"; -option optimize_for = SPEED; - -// Response of GET api/settings/list_definitions -message ListDefinitionsWsResponse { - repeated Definition definitions = 1; -} - -// Response of GET api/settings/encrypt -message EncryptWsResponse { - string encryptedValue = 1; -} - -// Response of GET api/settings/generate_secret_key -message GenerateSecretKeyWsResponse { - string secretKey = 1; -} - -// Response of GET api/settings/check_secret_key -message CheckSecretKeyWsResponse { - bool secretKeyAvailable = 1; -} - -message Definition { - string key = 1; - oneof nameOneOf {string name = 2;} - string description = 3; - Type type = 4; - oneof categoryOneOf {string category = 5;} - oneof subCategoryOneOf {string subCategory = 6;} - oneof defaultValueOneOf {string defaultValue = 7;} - bool multiValues = 8; - repeated string options = 9; - repeated Field fields = 10; - oneof deprecatedKeyOneOf {string deprecatedKey = 11;} -} - -message Field { - string key = 1; - string name = 2; - string description = 3; - Type type = 4; - repeated string options = 5; -} - -enum Type { - STRING = 0; - TEXT = 1; - PASSWORD = 2; - BOOLEAN = 3; - INTEGER = 4; - FLOAT = 5; - LONG = 6; - REGULAR_EXPRESSION = 7; - METRIC = 8; - USER_LOGIN = 9; - METRIC_LEVEL = 10; - SINGLE_SELECT_LIST = 11; - PROPERTY_SET = 12; - LICENSE = 13; -} - -// Response of GET api/settings/values -message ValuesWsResponse { - repeated Setting settings = 1; -} - -message Setting { - string key = 1; - oneof valueOneOf { - string value = 2; - Values values = 3; - FieldValues fieldValues = 4; - } - bool inherited = 5; - oneof parentValueOneOf { - string parentValue = 6; - Values parentValues = 7; - FieldValues parentFieldValues = 8; - } -} - -message Values { - repeated string values = 1; -} - -message FieldValues { - repeated Value fieldValues = 1; - - message Value { - map value = 1; - } -} - - - diff --git a/sonar-ws/src/main/protobuf/ws-system.proto b/sonar-ws/src/main/protobuf/ws-system.proto deleted file mode 100644 index 5a6cddfe4e8..00000000000 --- a/sonar-ws/src/main/protobuf/ws-system.proto +++ /dev/null @@ -1,77 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.system; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsSystem"; -option optimize_for = SPEED; - -// GET api/system/health -message HealthResponse { - optional Health health = 1; - repeated Cause causes = 2; - optional Nodes nodes = 3; -} - -message Nodes { - repeated Node nodes = 1; -} - -// GET api/system/status -message StatusResponse { - optional string id = 1; - optional string version = 2; - optional Status status = 3; -} - -message Cause { - optional string message = 1; -} - -enum Health { - GREEN = 0; - YELLOW = 1; - RED = 2; -} - -enum Status { - STARTING = 0; - UP = 1; - DOWN = 2; - RESTARTING = 3; - DB_MIGRATION_NEEDED = 4; - DB_MIGRATION_RUNNING = 5; -} - -message Node { - optional string name = 1; - optional NodeType type = 2; - optional string host = 3; - optional int32 port = 4; - optional string startedAt = 5; - optional Health health = 6; - repeated Cause causes = 7; -} - -enum NodeType { - APPLICATION = 0; - SEARCH = 1; -} diff --git a/sonar-ws/src/main/protobuf/ws-tests.proto b/sonar-ws/src/main/protobuf/ws-tests.proto deleted file mode 100644 index 5138b369cdd..00000000000 --- a/sonar-ws/src/main/protobuf/ws-tests.proto +++ /dev/null @@ -1,68 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.tests; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsTests"; -option optimize_for = SPEED; - -// WS api/tests/list -message ListResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Test tests = 2; -} - -// WS api/tests/covered_files -message CoveredFilesResponse { - repeated CoveredFile files = 1; - - message CoveredFile { - optional string id = 1; - optional string key = 2; - optional string longName = 3; - optional int32 coveredLines = 4; - optional string branch = 5; - } -} - - -message Test { - optional string id = 1; - optional string name = 2; - optional string fileId = 3; - optional string fileKey = 4; - optional string fileName = 5; - optional TestStatus status = 6; - optional int64 durationInMs = 7; - optional int32 coveredLines = 8; - optional string message = 9; - optional string stacktrace = 10; - optional string fileBranch = 11; -} - -enum TestStatus { - OK = 1; - FAILURE = 2; - ERROR = 3; - SKIPPED = 4; -} diff --git a/sonar-ws/src/main/protobuf/ws-user_groups.proto b/sonar-ws/src/main/protobuf/ws-user_groups.proto deleted file mode 100644 index 25c7704ce9f..00000000000 --- a/sonar-ws/src/main/protobuf/ws-user_groups.proto +++ /dev/null @@ -1,52 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.usergroup; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsUserGroups"; -option optimize_for = SPEED; - -// WS api/user_groups/create -message CreateWsResponse { - optional Group group = 1; -} - -// WS api/user_groups/update -message UpdateWsResponse { - optional Group group = 1; -} - -// WS api/user_groups/search -message SearchWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Group groups = 2; -} - -message Group { - optional int64 id = 1; - optional string organization = 2; - optional string name = 3; - optional string description = 4; - optional int32 membersCount = 5; - optional bool default = 6; -} diff --git a/sonar-ws/src/main/protobuf/ws-user_tokens.proto b/sonar-ws/src/main/protobuf/ws-user_tokens.proto deleted file mode 100644 index f1e1ae4311a..00000000000 --- a/sonar-ws/src/main/protobuf/ws-user_tokens.proto +++ /dev/null @@ -1,43 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.usertoken; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsUserTokens"; -option optimize_for = SPEED; - -// WS api/user_tokens/generate -message GenerateWsResponse { - optional string login = 1; - optional string name = 2; - optional string token = 3; -} - -// WS api/user_tokens/search -message SearchWsResponse { - optional string login = 1; - repeated UserToken userTokens = 2; - - message UserToken { - optional string name = 1; - optional string createdAt = 2; - } -} diff --git a/sonar-ws/src/main/protobuf/ws-users.proto b/sonar-ws/src/main/protobuf/ws-users.proto deleted file mode 100644 index cf5a9d96456..00000000000 --- a/sonar-ws/src/main/protobuf/ws-users.proto +++ /dev/null @@ -1,116 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.users; - -import "ws-commons.proto"; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "WsUsers"; -option optimize_for = SPEED; - -// WS api/users/search -message SearchWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated User users = 2; - - message User { - optional string login = 1; - optional string name = 2; - optional bool active = 3; - optional string email = 4; - optional ScmAccounts scmAccounts = 5; - optional Groups groups = 6; - optional int32 tokensCount = 7; - optional bool local = 8; - optional string externalIdentity = 9; - optional string externalProvider = 10; - optional string avatar = 11; - } - - message Groups { - repeated string groups = 1; - } - - message ScmAccounts { - repeated string scmAccounts = 1; - } -} - -// WS api/users/identity_providers -message IdentityProvidersWsResponse { - repeated IdentityProvider identityProviders = 1; -} - -message IdentityProvider { - optional string key = 1; - optional string name = 2; - optional string iconPath = 3; - optional string backgroundColor = 4; -} - -message CreateWsResponse { - optional User user = 1; - - message User { - optional string login = 1; - optional string name = 2; - optional string email = 3; - repeated string scmAccounts = 4; - optional bool active = 5; - optional bool local = 6; - } -} - -// WS api/users/groups -message GroupsWsResponse { - optional sonarqube.ws.commons.Paging paging = 1; - repeated Group groups = 2; - - message Group { - optional int64 id = 1; - optional string name = 2; - optional string description = 3; - optional bool selected = 4; - optional bool default = 5; - } -} - -// WS api/users/current -message CurrentWsResponse { - optional bool isLoggedIn = 1; - optional string login = 2; - optional string name = 3; - optional string email = 4; - optional bool local = 5; - optional string externalIdentity = 6; - optional string externalProvider = 7; - repeated string scmAccounts = 8; - repeated string groups = 9; - optional Permissions permissions = 10; - optional bool showOnboardingTutorial = 11; - optional string avatar = 12; - - message Permissions { - repeated string global = 1; - } -} - - diff --git a/sonar-ws/src/main/protobuf/ws-webhooks.proto b/sonar-ws/src/main/protobuf/ws-webhooks.proto deleted file mode 100644 index a7ef3a9ab2b..00000000000 --- a/sonar-ws/src/main/protobuf/ws-webhooks.proto +++ /dev/null @@ -1,49 +0,0 @@ -// SonarQube, open source software quality management tool. -// Copyright (C) 2008-2016 SonarSource -// mailto:contact AT sonarsource DOT com -// -// SonarQube 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. -// -// SonarQube 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. - -syntax = "proto2"; - -package sonarqube.ws.webhooks; - -option java_package = "org.sonarqube.ws"; -option java_outer_classname = "Webhooks"; -option optimize_for = SPEED; - -// WS api/webhooks/deliveries -message DeliveriesWsResponse { - repeated Delivery deliveries = 1; -} - -// WS api/webhooks/delivery -message DeliveryWsResponse { - optional Delivery delivery = 1; -} - -message Delivery { - optional string id = 1; - optional string componentKey = 2; - optional string ceTaskId = 3; - optional string name = 4; - optional string url = 5; - optional string at = 6; - optional bool success = 7; - optional int32 httpStatus = 8; - optional int32 durationMs = 9; - optional string payload = 10; - optional string errorStacktrace = 11; -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/MessageFormatterTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/MessageFormatterTest.java index 0b191217896..2d1a66df6d6 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/MessageFormatterTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/MessageFormatterTest.java @@ -27,7 +27,7 @@ public class MessageFormatterTest { @Test public void print() { - WsPermissions.Permission.Builder message = WsPermissions.Permission.newBuilder() + Permissions.Permission.Builder message = Permissions.Permission.newBuilder() .setName("permission-name") .setKey("permission-key") .setDescription("permission-description") @@ -36,7 +36,7 @@ public class MessageFormatterTest { String result = MessageFormatter.print(message); - assertThat(result).isEqualTo("org.sonarqube.ws.WsPermissions.Permission.Builder" + + assertThat(result).isEqualTo("org.sonarqube.ws.Permissions.Permission.Builder" + "[key: \"permission-key\" name: \"permission-name\" description: \"permission-description\" usersCount: 1984 groupsCount: 42]"); } } diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java deleted file mode 100644 index b75aec5e9cc..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.ce; - -import com.google.common.collect.ImmutableList; -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsCe.ActivityResponse; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.data.MapEntry.entry; -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE; - -public class CeServiceTest { - private static final String VALUE_COMPONENT_ID = "component-uuid"; - private static final String VALUE_QUERY = "component-query"; - private static final String VALUE_TASK_STATUS_1 = "task-status"; - private static final String VALUE_TASK_STATUS_2 = "task-status-2"; - private static final String VALUE_TASK_TYPE = "task-type"; - private static final int VALUE_PAGE = 1; - private static final int VALUE_PAGE_SIZE = 10; - private static final String VALUE_MAX_EXECUTED_AT = "2015-09-17T23:34:59+0200"; - private static final String VALUE_MIN_SUBMITTED_AT = "2015-09-17T23:34:59+0200"; - private static final boolean VALUE_ONLY_CURRENTS = true; - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new CeService(mock(WsConnector.class))); - - CeService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void activity() { - ActivityWsRequest request = new ActivityWsRequest() - .setComponentId(VALUE_COMPONENT_ID) - .setQuery(VALUE_QUERY) - .setStatus(ImmutableList.of(VALUE_TASK_STATUS_1, VALUE_TASK_STATUS_2)) - .setType(VALUE_TASK_TYPE) - .setPage(VALUE_PAGE) - .setPageSize(VALUE_PAGE_SIZE) - .setMaxExecutedAt(VALUE_MAX_EXECUTED_AT) - .setMinSubmittedAt(VALUE_MIN_SUBMITTED_AT) - .setOnlyCurrents(VALUE_ONLY_CURRENTS) - .setPage(1) - .setPageSize(1); - - underTest.activity(request); - GetRequest result = serviceTester.getGetRequest(); - - assertThat(serviceTester.getGetParser()).isSameAs(ActivityResponse.parser()); - serviceTester.assertThat(result) - .hasPath("activity") - .hasParam(PARAM_COMPONENT_ID, VALUE_COMPONENT_ID) - .hasParam("q", VALUE_QUERY) - .hasParam(PARAM_STATUS, VALUE_TASK_STATUS_1 + "," + VALUE_TASK_STATUS_2) - .hasParam(PARAM_TYPE, VALUE_TASK_TYPE) - .hasParam(PARAM_MAX_EXECUTED_AT, VALUE_MAX_EXECUTED_AT) - .hasParam(PARAM_MIN_SUBMITTED_AT, VALUE_MIN_SUBMITTED_AT) - .hasParam(PARAM_ONLY_CURRENTS, VALUE_ONLY_CURRENTS) - .hasParam("p", 1) - .hasParam("ps", 1) - .andNoOtherParam(); - } - - @Test - public void task_types() { - underTest.taskTypes(); - - assertThat(serviceTester.getGetParser()).isSameAs(WsCe.TaskTypesWsResponse.parser()); - } - - @Test - public void task_by_id_only() { - underTest.task("task_id"); - - assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task"); - assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id")); - } - - @Test - public void task_with_stacktrace_and_scanner_context() { - underTest.task(TaskWsRequest.newBuilder("task_id") - .withErrorStacktrace() - .withScannerContext() - .build()); - - assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task"); - assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace,scannerContext")); - } - - @Test - public void task_with_scanner_context_only() { - underTest.task(TaskWsRequest.newBuilder("task_id") - .withScannerContext() - .build()); - - assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task"); - assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "scannerContext")); - } - - @Test - public void task_with_stacktrace_only() { - underTest.task(TaskWsRequest.newBuilder("task_id") - .withErrorStacktrace() - .build()); - - assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task"); - assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace")); - } - - @Test - public void worker_count() { - underTest.workerCount(); - - assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/worker_count"); - assertThat(serviceTester.getGetParser()).isSameAs(WsCe.WorkerCountResponse.parser()); - } - - @Test - public void component() { - underTest.component("my_component"); - GetRequest result = serviceTester.getGetRequest(); - - assertThat(serviceTester.getGetParser()).isSameAs(WsCe.ProjectResponse.parser()); - serviceTester.assertThat(result) - .hasPath("component") - .hasParam(PARAM_COMPONENT, "my_component") - .andNoOtherParam(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java index 61805bbdd1a..5e6f3fa211a 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java @@ -21,7 +21,7 @@ package org.sonarqube.ws.client.component; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsComponents; +import org.sonarqube.ws.Components; import org.sonarqube.ws.client.ServiceTester; import org.sonarqube.ws.client.WsConnector; @@ -57,7 +57,7 @@ public class ComponentsServiceTest { .setAdditionalFields(singletonList("analysisDate")) .build()); - assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchProjectsWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search_projects") .hasParam(PARAM_FILTER, "ncloc > 10") @@ -79,7 +79,7 @@ public class ComponentsServiceTest { .setPageSize(10) .build()); - assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchProjectsWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search_projects") .hasParam(PARAM_FILTER, "ncloc > 10") @@ -98,7 +98,7 @@ public class ComponentsServiceTest { .setId(id) .setBranch("my_branch")); - assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.ShowWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Components.ShowWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("show") .hasParam("component", key) @@ -141,7 +141,7 @@ public class ComponentsServiceTest { .setPageSize(pageSize) .setQuery(textQuery)); - assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search") .hasParam("organization", organization) @@ -172,7 +172,7 @@ public class ComponentsServiceTest { .setQuery(query) .setSort(asList("sort1", "sort2"))); - assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.TreeWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Components.TreeWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java index c8d4e66d339..653d79aba19 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.List; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse; -import org.sonarqube.ws.WsMeasures.ComponentWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures.ComponentWsResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.ServiceTester; import org.sonarqube.ws.client.WsConnector; @@ -169,7 +169,7 @@ public class MeasuresServiceTest { underTest.searchHistory(request); GetRequest getRequest = serviceTester.getGetRequest(); - assertThat(serviceTester.getGetParser()).isSameAs(WsMeasures.SearchHistoryResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchHistoryResponse.parser()); serviceTester.assertThat(getRequest) .hasParam(PARAM_COMPONENT, VALUE_COMPONENT) .hasParam(PARAM_BRANCH, "my_branch") @@ -191,7 +191,7 @@ public class MeasuresServiceTest { underTest.search(request); GetRequest getRequest = serviceTester.getGetRequest(); - assertThat(serviceTester.getGetParser()).isSameAs(WsMeasures.SearchWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchWsResponse.parser()); serviceTester.assertThat(getRequest) .hasParam(PARAM_PROJECT_KEYS, "P1,P2") .hasParam(PARAM_METRIC_KEYS, "ncloc,complexity") diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java index fa45cf550c6..0d51269ce80 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java @@ -22,7 +22,7 @@ package org.sonarqube.ws.client.permission; import java.util.Arrays; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.Permissions; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.ServiceTester; @@ -92,7 +92,7 @@ public class PermissionsServiceTest { .setPageSize(PAGE_SIZE_VALUE) .setQuery(QUERY_VALUE)); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsGroupsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsGroupsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) .hasPath("groups") @@ -255,7 +255,7 @@ public class PermissionsServiceTest { .setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE) ); - assertThat(serviceTester.getPostParser()).isSameAs(WsPermissions.CreateTemplateWsResponse.parser()); + assertThat(serviceTester.getPostParser()).isSameAs(Permissions.CreateTemplateWsResponse.parser()); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester.assertThat(postRequest) .hasPath("create_template") @@ -378,7 +378,7 @@ public class PermissionsServiceTest { public void searchGlobalPermissions_does_GET_on_Ws_search_global_permissions() { underTest.searchGlobalPermissions(); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsSearchGlobalPermissionsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsSearchGlobalPermissionsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) .hasPath("search_global_permissions") @@ -396,7 +396,7 @@ public class PermissionsServiceTest { .setQuery(QUERY_VALUE) ); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchProjectPermissionsWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchProjectPermissionsWsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) .hasPath("search_project_permissions") @@ -415,7 +415,7 @@ public class PermissionsServiceTest { .setQuery(QUERY_VALUE) ); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchTemplatesWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchTemplatesWsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) .hasPath("search_templates") @@ -450,7 +450,7 @@ public class PermissionsServiceTest { .setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE) ); - assertThat(serviceTester.getPostParser()).isSameAs(WsPermissions.UpdateTemplateWsResponse.parser()); + assertThat(serviceTester.getPostParser()).isSameAs(Permissions.UpdateTemplateWsResponse.parser()); PostRequest postRequest = serviceTester.getPostRequest(); serviceTester.assertThat(postRequest) .hasPath("update_template") @@ -513,7 +513,7 @@ public class PermissionsServiceTest { .setPageSize(50) ); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.UsersWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Permissions.UsersWsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java index d1a094f3fcc..657b7f0e478 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java @@ -22,7 +22,7 @@ package org.sonarqube.ws.client.project; import java.util.Arrays; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsProjects; +import org.sonarqube.ws.Projects; import org.sonarqube.ws.client.ServiceTester; import org.sonarqube.ws.client.WsConnector; @@ -47,7 +47,7 @@ public class ProjectsServiceTest { .setName("Project Name") .build()); - assertThat(serviceTester.getPostParser()).isSameAs(WsProjects.CreateWsResponse.parser()); + assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser()); assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create"); assertThat(serviceTester.getPostRequest().getParams()).containsOnly( entry("project", "project_key"), @@ -62,7 +62,7 @@ public class ProjectsServiceTest { .setName("Project Name") .build()); - assertThat(serviceTester.getPostParser()).isSameAs(WsProjects.CreateWsResponse.parser()); + assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser()); assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create"); assertThat(serviceTester.getPostRequest().getParams()).containsOnly( entry("organization", "org_key"), diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java index eb8f57f3444..a20137651fe 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java @@ -22,8 +22,8 @@ package org.sonarqube.ws.client.projectbranches; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsBranches.ListWsResponse; -import org.sonarqube.ws.WsBranches.ShowWsResponse; +import org.sonarqube.ws.ProjectBranches.ListWsResponse; +import org.sonarqube.ws.ProjectBranches.ShowWsResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.ServiceTester; @@ -38,9 +38,9 @@ import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters. public class ProjectBranchesServiceTest { @Rule - public ServiceTester serviceTester = new ServiceTester<>(new ProjectBranchesService(mock(WsConnector.class))); + public ServiceTester serviceTester = new ServiceTester<>(new ProjectBranchesServiceOld(mock(WsConnector.class))); - private ProjectBranchesService underTest = serviceTester.getInstanceUnderTest(); + private ProjectBranchesServiceOld underTest = serviceTester.getInstanceUnderTest(); @Test public void list() { diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java index bc00d51a78c..3ebf9c68a23 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java @@ -21,8 +21,8 @@ package org.sonarqube.ws.client.projectlinks; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsProjectLinks.CreateWsResponse; -import org.sonarqube.ws.WsProjectLinks.SearchWsResponse; +import org.sonarqube.ws.ProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.ServiceTester; diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequestTest.java deleted file mode 100644 index 5d4e3e5c9ee..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/CreateConditionRequestTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class CreateConditionRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - CreateConditionRequest.Builder underTest = CreateConditionRequest.builder(); - - @Test - public void create_condition_request() { - CreateConditionRequest result = underTest - .setQualityGateId(10) - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .setError("error") - .setPeriod(1) - .build(); - - assertThat(result.getQualityGateId()).isEqualTo(10); - assertThat(result.getMetricKey()).isEqualTo("metric"); - assertThat(result.getOperator()).isEqualTo("LT"); - assertThat(result.getWarning()).isEqualTo("warning"); - assertThat(result.getError()).isEqualTo("error"); - assertThat(result.getPeriod()).isEqualTo(1); - } - - @Test - public void fail_when_no_quality_gate() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Quality gate id is mandatory and must not be empty"); - - underTest - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .build(); - } - - @Test - public void fail_when_no_metric() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Metric key is mandatory and must not be empty"); - - underTest - .setQualityGateId(10) - .setOperator("LT") - .setWarning("warning") - .build(); - } - - @Test - public void fail_when_no_operator() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Operator is mandatory and must not be empty"); - - underTest - .setQualityGateId(10) - .setMetricKey("metric") - .setWarning("warning") - .build(); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/QualityGatesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/QualityGatesServiceTest.java deleted file mode 100644 index 5f66c8a395a..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/QualityGatesServiceTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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. - */ - -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact 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.qualitygate; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; - -public class QualityGatesServiceTest { - private static final String PROJECT_ID_VALUE = "195"; - private static final String PROJECT_KEY_VALUE = "project_key_value"; - private static final Long GATE_ID_VALUE = 243L; - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new QualityGatesService(mock(WsConnector.class))); - - private QualityGatesService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void associate_project() { - underTest.associateProject(new SelectWsRequest() - .setGateId(GATE_ID_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE)); - - assertThat(serviceTester.getPostParser()).isNull(); - - PostRequest postRequest = serviceTester.getPostRequest(); - - serviceTester.assertThat(postRequest) - .hasPath("select") - .hasParam(PARAM_GATE_ID, String.valueOf(GATE_ID_VALUE)) - .hasParam(PARAM_PROJECT_ID, String.valueOf(PROJECT_ID_VALUE)) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .andNoOtherParam(); - } - - @Test - public void project_status() { - underTest.projectStatus(new ProjectStatusWsRequest() - .setAnalysisId("analysisId") - .setProjectId("projectId") - .setProjectKey("projectKey")); - GetRequest getRequest = serviceTester.getGetRequest(); - - assertThat(serviceTester.getGetParser()).isSameAs(ProjectStatusWsResponse.parser()); - serviceTester.assertThat(getRequest) - .hasParam(PARAM_ANALYSIS_ID, "analysisId") - .hasParam(PARAM_PROJECT_ID, "projectId") - .hasParam(PARAM_PROJECT_KEY, "projectKey") - .andNoOtherParam(); - } - - @Test - public void create() { - underTest.create("Default"); - PostRequest request = serviceTester.getPostRequest(); - - assertThat(serviceTester.getPostParser()).isSameAs(CreateWsResponse.parser()); - serviceTester.assertThat(request) - .hasParam(PARAM_NAME, "Default") - .andNoOtherParam(); - } - - @Test - public void create_condition() { - underTest.createCondition(CreateConditionRequest.builder() - .setQualityGateId(10) - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .setError("error") - .setPeriod(1) - .build()); - - PostRequest request = serviceTester.getPostRequest(); - - assertThat(serviceTester.getPostParser()).isSameAs(CreateConditionWsResponse.parser()); - serviceTester.assertThat(request) - .hasPath("create_condition") - .hasParam(PARAM_GATE_ID, 10) - .hasParam(PARAM_METRIC, "metric") - .hasParam(PARAM_OPERATOR, "LT") - .hasParam(PARAM_WARNING, "warning") - .hasParam(PARAM_ERROR, "error") - .hasParam(PARAM_PERIOD, 1) - .andNoOtherParam(); - } - - @Test - public void update_condition() { - underTest.updateCondition(UpdateConditionRequest.builder() - .setConditionId(10) - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .setError("error") - .setPeriod(1) - .build()); - - PostRequest request = serviceTester.getPostRequest(); - - assertThat(serviceTester.getPostParser()).isSameAs(UpdateConditionWsResponse.parser()); - serviceTester.assertThat(request) - .hasPath("update_condition") - .hasParam(PARAM_ID, 10) - .hasParam(PARAM_METRIC, "metric") - .hasParam(PARAM_OPERATOR, "LT") - .hasParam(PARAM_WARNING, "warning") - .hasParam(PARAM_ERROR, "error") - .hasParam(PARAM_PERIOD, 1) - .andNoOtherParam(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequestTest.java deleted file mode 100644 index 36e5b37fb4c..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualitygate/UpdateConditionRequestTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.qualitygate; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class UpdateConditionRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - UpdateConditionRequest.Builder underTest = UpdateConditionRequest.builder(); - - @Test - public void create_condition_request() { - UpdateConditionRequest result = underTest - .setConditionId(10) - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .setError("error") - .setPeriod(1) - .build(); - - assertThat(result.getConditionId()).isEqualTo(10); - assertThat(result.getMetricKey()).isEqualTo("metric"); - assertThat(result.getOperator()).isEqualTo("LT"); - assertThat(result.getWarning()).isEqualTo("warning"); - assertThat(result.getError()).isEqualTo("error"); - assertThat(result.getPeriod()).isEqualTo(1); - } - - @Test - public void fail_when_no_quality_gate() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Condition id is mandatory and must not be empty"); - - underTest - .setMetricKey("metric") - .setOperator("LT") - .setWarning("warning") - .build(); - } - - @Test - public void fail_when_no_metric() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Metric key is mandatory and must not be empty"); - - underTest - .setConditionId(10) - .setOperator("LT") - .setWarning("warning") - .build(); - } - - @Test - public void fail_when_no_operator() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Operator is mandatory and must not be empty"); - - underTest - .setConditionId(10) - .setMetricKey("metric") - .setWarning("warning") - .build(); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java index 8d90866470c..015186a588e 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java @@ -22,9 +22,9 @@ package org.sonarqube.ws.client.qualityprofile; import org.junit.Rule; import org.junit.Test; import org.sonarqube.ws.Common.Severity; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.ServiceTester; @@ -48,7 +48,6 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters. import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SEVERITY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TO_NAME; @@ -256,7 +255,7 @@ public class QualityProfilesServiceTest { ); GetRequest getRequest = serviceTester.getGetRequest(); - assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchUsersResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Qualityprofiles.SearchUsersResponse.parser()); serviceTester.assertThat(getRequest) .hasPath("search_users") .hasParam(PARAM_ORGANIZATION, "O1") @@ -321,7 +320,7 @@ public class QualityProfilesServiceTest { ); GetRequest getRequest = serviceTester.getGetRequest(); - assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchGroupsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Qualityprofiles.SearchGroupsResponse.parser()); serviceTester.assertThat(getRequest) .hasPath("search_groups") .hasParam(PARAM_ORGANIZATION, "O1") diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java index 145642a5278..766baa37520 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java @@ -31,9 +31,9 @@ import static org.mockito.Mockito.mock; public class SystemServiceTest { @Rule - public ServiceTester serviceTester = new ServiceTester<>(new SystemService(mock(WsConnector.class))); + public ServiceTester serviceTester = new ServiceTester<>(new SystemServiceOld(mock(WsConnector.class))); - private SystemService underTest = serviceTester.getInstanceUnderTest(); + private SystemServiceOld underTest = serviceTester.getInstanceUnderTest(); @Test public void test_health() throws Exception { diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/user/UsersServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/user/UsersServiceTest.java index 7d26c5f238a..a0d870b3b90 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/user/UsersServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/user/UsersServiceTest.java @@ -21,9 +21,9 @@ package org.sonarqube.ws.client.user; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.CreateWsResponse; -import org.sonarqube.ws.WsUsers.GroupsWsResponse; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.CreateWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse; import org.sonarqube.ws.client.ServiceTester; import org.sonarqube.ws.client.WsConnector; @@ -59,7 +59,7 @@ public class UsersServiceTest { .setPossibleFields(asList("email", "name")) .build()); - assertThat(serviceTester.getGetParser()).isSameAs(WsUsers.SearchWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Users.SearchWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasParam(TEXT_QUERY, "john") .hasParam(PAGE, 10) @@ -133,6 +133,6 @@ public class UsersServiceTest { public void current() { underTest.current(); - assertThat(serviceTester.getGetParser()).isSameAs(WsUsers.CurrentWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(Users.CurrentWsResponse.parser()); } } diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java index 57d19f13ab1..d4bac214257 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java @@ -28,9 +28,9 @@ import org.sonarqube.ws.client.WsConnector; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.WsUserGroups.CreateWsResponse; -import static org.sonarqube.ws.WsUserGroups.SearchWsResponse; -import static org.sonarqube.ws.WsUserGroups.UpdateWsResponse; +import static org.sonarqube.ws.UserGroups.CreateWsResponse; +import static org.sonarqube.ws.UserGroups.SearchWsResponse; +import static org.sonarqube.ws.UserGroups.UpdateWsResponse; public class UserGroupsServiceTest { diff --git a/tests/plugins/ws-plugin/src/main/java/LocalCallWebService.java b/tests/plugins/ws-plugin/src/main/java/LocalCallWebService.java index 7de752bba25..d626d68d02f 100644 --- a/tests/plugins/ws-plugin/src/main/java/LocalCallWebService.java +++ b/tests/plugins/ws-plugin/src/main/java/LocalCallWebService.java @@ -22,7 +22,7 @@ import org.sonar.api.server.ws.RequestHandler; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.LocalWsClientFactory; import org.sonarqube.ws.client.WsClient; @@ -50,7 +50,7 @@ public final class LocalCallWebService implements WebService { public void handle(Request request, Response response) throws Exception { WsClient client = wsClientFactory.newClient(request.localConnector()); - WsCe.TaskTypesWsResponse ceTaskTypes = client.ce().taskTypes(); + Ce.TaskTypesWsResponse ceTaskTypes = client.ce().taskTypes(); response.stream().setStatus(ceTaskTypes.getTaskTypesCount() > 0 ? 200 : 500); } } diff --git a/tests/pom.xml b/tests/pom.xml index 36edfa2bc3f..c36c4aaee20 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -42,6 +42,13 @@ ${orchestrator.version} test + + + org.codehaus.sonar + sonar-ws-client + 5.0 + org.sonarsource.sonarqube sonar-application @@ -67,11 +74,6 @@ ${project.version} provided - - org.codehaus.sonar - sonar-ws-client - 5.0 - junit junit @@ -80,10 +82,6 @@ org.assertj assertj-core - - org.assertj - assertj-guava - org.hamcrest hamcrest-all @@ -97,19 +95,10 @@ jsonassert 1.2.0 - - org.jsoup - jsoup - 1.8.3 - com.squareup.okhttp3 mockwebserver - - org.apache.commons - commons-email - org.subethamail subethasmtp diff --git a/tests/src/test/java/org/sonarqube/tests/Category1Suite.java b/tests/src/test/java/org/sonarqube/tests/Category1Suite.java index 34afd54d11b..eca1a1038f7 100644 --- a/tests/src/test/java/org/sonarqube/tests/Category1Suite.java +++ b/tests/src/test/java/org/sonarqube/tests/Category1Suite.java @@ -24,7 +24,6 @@ import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.sonarqube.tests.ce.BackgroundTasksTest; -import org.sonarqube.tests.projectAdministration.ProjectAdministrationTest; import org.sonarqube.tests.settings.DeprecatedPropertiesWsTest; import org.sonarqube.tests.settings.EmailsTest; import org.sonarqube.tests.settings.PropertySetsTest; @@ -42,7 +41,6 @@ import static util.ItUtils.xooPlugin; @RunWith(Suite.class) @Suite.SuiteClasses({ UsersPageTest.class, - ProjectAdministrationTest.class, BackgroundTasksTest.class, DeprecatedPropertiesWsTest.class, EmailsTest.class, @@ -57,18 +55,19 @@ public class Category1Suite { .addPlugin(pluginArtifact("property-sets-plugin")) .addPlugin(pluginArtifact("sonar-subcategories-plugin")) - // Used in I18nTest - .addPlugin(pluginArtifact("l10n-fr-pack")) - - // 1 second. Required for notification test. - .setServerProperty("sonar.notifications.delay", "1") - // Used in SettingsTest.global_property_change_extension_point .addPlugin(pluginArtifact("global-property-change-plugin")) // Used in SettingsTest.should_get_settings_default_value .addPlugin(pluginArtifact("server-plugin")) + + // Used in I18nTest + .addPlugin(pluginArtifact("l10n-fr-pack")) + + // 1 second. Required for notification test. + .setServerProperty("sonar.notifications.delay", "1") + .addPlugin(pluginArtifact("posttask-plugin")) // reduce memory for Elasticsearch to 128M diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java index db55ef7f23f..c0615144afd 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java @@ -35,16 +35,16 @@ import org.junit.After; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.tests.Byteman; import org.sonarqube.qa.util.Tester; +import org.sonarqube.tests.Byteman; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; import org.sonarqube.ws.Issues; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsProjects; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; -import org.sonarqube.ws.client.ce.TaskWsRequest; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.Users.CreateWsResponse.User; +import org.sonarqube.ws.client.ce.TaskRequest; import org.sonarqube.ws.client.component.SuggestionsWsRequest; import org.sonarqube.ws.client.issue.SearchWsRequest; import util.ItUtils; @@ -52,7 +52,7 @@ import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.sonarqube.tests.Byteman.Process.CE; -import static org.sonarqube.ws.WsCe.TaskStatus.FAILED; +import static org.sonarqube.ws.Ce.TaskStatus.FAILED; import static util.ItUtils.projectDir; public class AnalysisEsResilienceTest { @@ -86,7 +86,7 @@ public class AnalysisEsResilienceTest { public void activation_and_deactivation_of_rule_is_resilient_to_indexing_errors() throws Exception { Organization organization = tester.organizations().generate(); User orgAdministrator = tester.users().generateAdministrator(organization); - WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization); + Projects.CreateWsResponse.Project project = tester.projects().provision(organization); String projectKey = project.getKey(); String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo"; String file2Key = projectKey + ":src/main/xoo/sample/Sample2.xoo"; @@ -134,7 +134,7 @@ public class AnalysisEsResilienceTest { public void purge_mechanism_must_be_resilient_at_next_analysis() throws Exception { Organization organization = tester.organizations().generate(); User orgAdministrator = tester.users().generateAdministrator(organization); - WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization); + Projects.CreateWsResponse.Project project = tester.projects().provision(organization); String projectKey = project.getKey(); String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo"; @@ -158,9 +158,9 @@ public class AnalysisEsResilienceTest { String taskUuid = executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-purge", "2000-01-02"); // The task has failed - TaskWsRequest request = TaskWsRequest.newBuilder(taskUuid).withErrorStacktrace().build(); - WsCe.Task task = tester.wsClient().ce().task(request).getTask(); - assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED); + TaskRequest request = new TaskRequest().setId(taskUuid).setAdditionalFields(Collections.singletonList("stacktrace")); + Ce.Task task = tester.wsClient().ce().task(request).getTask(); + assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED); assertThat(task.getErrorMessage()).contains("Unrecoverable indexation failures"); assertThat(task.getErrorStacktrace()) .contains("Caused by: java.lang.IllegalStateException: Unrecoverable indexation failures"); @@ -208,7 +208,7 @@ public class AnalysisEsResilienceTest { public void compute_engine_task_must_be_red_when_es_is_not_available() throws Exception { Organization organization = tester.organizations().generate(); User orgAdministrator = tester.users().generateAdministrator(organization); - WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization); + Projects.CreateWsResponse.Project project = tester.projects().provision(organization); String projectKey = project.getKey(); String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo"; @@ -220,7 +220,7 @@ public class AnalysisEsResilienceTest { tester.elasticsearch().lockWrites("issues"); String analysisKey = executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-sample-v1", null); - WsCe.TaskResponse task = tester.wsClient().ce().task(analysisKey); + Ce.TaskResponse task = tester.wsClient().ce().task(new TaskRequest().setId(analysisKey)); assertThat(task.getTask().getStatus()).isEqualTo(FAILED); } diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java index f94f6aa2833..1bb37ef7303 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java @@ -29,7 +29,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.sonarqube.ws.Favorites; import org.sonarqube.ws.Favorites.Favorite; -import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.Permissions; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.favorite.SearchRequest; import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; @@ -105,7 +105,7 @@ public class FavoriteTest { } private void addProjectCreatorPermission() { - WsPermissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) @@ -114,7 +114,7 @@ public class FavoriteTest { } private void removeProjectCreatorPermission() { - WsPermissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); adminWsClient.permissions().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java index c5e11147036..980cd9cafae 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java @@ -27,7 +27,7 @@ import java.util.Map; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; -import org.sonarqube.ws.WsComponents.Component; +import org.sonarqube.ws.Components.Component; import org.sonarqube.ws.client.component.TreeWsRequest; import util.ItUtils; diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java index 615a5a2aeb6..19dc6faba4c 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java @@ -22,11 +22,13 @@ package org.sonarqube.tests.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; -import org.sonarqube.tests.Category4Suite; import java.util.Map; -import org.junit.Before; import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; +import org.sonarqube.qa.util.Tester; +import org.sonarqube.tests.Category4Suite; +import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -40,10 +42,10 @@ public class IssueExclusionsTest { @ClassRule public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; - @Before - public void resetData() { - orchestrator.resetData(); - } + @Rule + public Tester tester = new Tester(orchestrator) + // all the tests of Category4Suite must disable organizations + .disableOrganizations(); @Test public void should_not_exclude_anything() { @@ -233,9 +235,12 @@ public class IssueExclusionsTest { protected BuildResult scan(String... properties) { ItUtils.restoreProfile(orchestrator, getClass().getResource("/exclusions/IssueExclusionsTest/with-many-rules.xml")); - orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-exclusions", - "Sonar :: Integration Tests :: Multi-modules With Exclusions"); - orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules"); + + tester.projects().provision(p -> p + .setKey("com.sonarsource.it.samples:multi-modules-exclusions") + .setName("Sonar :: Integration Tests :: Multi-modules With Exclusions")); + tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder().setProjectKey("com.sonarsource.it.samples:multi-modules-exclusions") + .setLanguage("xoo").setQualityProfile("with-many-rules").build()); SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR)) .setProperty("sonar.cpd.exclusions", "**/*") diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java index eb14836b2c1..574dc29c367 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java @@ -29,7 +29,7 @@ import java.util.Optional; import org.junit.After; import org.junit.ClassRule; import org.junit.Test; -import org.sonarqube.ws.WsProjectLinks; +import org.sonarqube.ws.ProjectLinks; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.projectlinks.SearchWsRequest; import util.ItUtils; @@ -75,7 +75,7 @@ public class LinksTest { private void verifyLinks() { WsClient wsClient = ItUtils.newWsClient(orchestrator); - List links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList(); + List links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList(); verifyLink(links, "homepage", "http://www.simplesample.org_OVERRIDDEN"); verifyLink(links, "ci", "http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE"); verifyLink(links, "issue", "http://jira.codehaus.org/browse/SIMPLESAMPLE"); @@ -83,8 +83,8 @@ public class LinksTest { verifyLink(links, "scm_dev", "scm:git:git@github.com:SonarSource/simplesample.git"); } - private void verifyLink(List links, String expectedType, String expectedUrl) { - Optional link = links.stream() + private void verifyLink(List links, String expectedType, String expectedUrl) { + Optional link = links.stream() .filter(l -> l.getType().equals(expectedType)) .findFirst(); assertThat(link).isPresent(); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java index 79663eec478..d0f4eefd4a4 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java @@ -29,7 +29,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsUserTokens; +import org.sonarqube.ws.UserTokens; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddUserWsRequest; import org.sonarqube.ws.client.usertoken.GenerateWsRequest; @@ -79,7 +79,7 @@ public class PermissionTest { createUserWithProvisioningAndScanPermissions(); String tokenName = "For test"; - WsUserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest() + UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest() .setLogin(A_LOGIN) .setName(tokenName)); SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java b/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java index cee2d04936e..12006e700ce 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java @@ -32,6 +32,7 @@ import static util.ItUtils.xooPlugin; ExecuteAnalysisPermissionTest.class, IssuePermissionTest.class, PermissionSearchTest.class, + PermissionTemplatePageTest.class, ProvisioningPermissionTest.class, QualityProfileAdminPermissionTest.class, SystemPasscodeTest.class diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java index 703544e337f..f14d2264b71 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java @@ -26,9 +26,9 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.Permission; -import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.Permission; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.permission.AddGroupToTemplateWsRequest; import org.sonarqube.ws.client.permission.AddGroupWsRequest; @@ -87,17 +87,17 @@ public class PermissionSearchTest { .setPermission("admin") .setGroupName(GROUP_NAME)); - WsPermissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions(); + Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions(); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getKey()).isEqualTo("admin"); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getUsersCount()).isEqualTo(1); // by default, a group has the global admin permission assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2); - WsPermissions.UsersWsResponse users = tester.wsClient().permissions() + Permissions.UsersWsResponse users = tester.wsClient().permissions() .users(new UsersWsRequest().setPermission("admin")); assertThat(users.getUsersList()).extracting("login").contains(LOGIN); - WsPermissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions() + Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions() .groups(new GroupsWsRequest() .setPermission("admin")); assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME); @@ -105,7 +105,7 @@ public class PermissionSearchTest { @Test public void template_permission_web_services() { - WsPermissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate( + Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate( new CreateTemplateWsRequest() .setName("my-new-template") .setDescription("template-used-in-tests")); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java new file mode 100644 index 00000000000..8ef4d43e9f9 --- /dev/null +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java @@ -0,0 +1,69 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests.authorization; + +import com.sonar.orchestrator.Orchestrator; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.sonarqube.qa.util.Tester; +import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; +import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; +import org.sonarqube.ws.client.permission.UsersWsRequest; + +import static org.assertj.core.api.Assertions.assertThat; + +public class PermissionTemplatePageTest { + + @ClassRule + public static Orchestrator orchestrator = AuthorizationSuite.ORCHESTRATOR; + + @Rule + public Tester tester = new Tester(orchestrator) + // all the tests of AuthorizationSuite must disable organizations + .disableOrganizations(); + + @Test + public void bulk_apply_permission_template() { + String project = tester.projects().provision().getKey(); + String userLogin = tester.users().generateMemberOfDefaultOrganization().getLogin(); + String adminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin(); + + tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest().setName("foo-template")); + tester.wsClient().permissions().addUserToTemplate( + new AddUserToTemplateWsRequest() + .setPermission("admin") + .setTemplateName("foo-template") + .setLogin(userLogin)); + + ProjectsManagementPage page = tester.openBrowser().logIn().submitCredentials(adminLogin).openProjectsManagement(); + page.shouldHaveProject(project); + page.bulkApplyPermissionTemplate("foo-template"); + Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest() + .setProjectKey(project) + .setPermission("admin") + ); + assertThat(usersResponse.getUsersCount()).isEqualTo(1); + assertThat(usersResponse.getUsers(0).getLogin()).isEqualTo(userLogin); + } + +} diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java index 66b925d4fc4..a0d4d4c7860 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java @@ -32,10 +32,10 @@ import org.junit.rules.Timeout; import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsUsers.CreateWsResponse; +import org.sonarqube.ws.Permissions; +import org.sonarqube.ws.Permissions.CreateTemplateWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Users.CreateWsResponse; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.component.SearchProjectsRequest; import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; @@ -89,7 +89,7 @@ public class PermissionTemplateTest { Organization organization = tester.organizations().generate(); CreateWsResponse.User user = tester.users().generateMember(organization); CreateWsResponse.User anotherUser = tester.users().generateMember(organization); - WsPermissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate(); + Permissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate(); tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateWsRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) @@ -179,7 +179,7 @@ public class PermissionTemplateTest { } private Project createPrivateProject(Organization organization) { - return tester.projects().generate(organization, p -> p.setVisibility("private")); + return tester.projects().provision(organization, p -> p.setVisibility("private")); } private void assertThatUserHasPermission(CreateWsResponse.User user, Organization organization, Project project) { @@ -203,8 +203,8 @@ public class PermissionTemplateTest { .setOrganization(organization.getKey()) .setProjectKey(project.getKey()) .setPermission("user"); - WsPermissions.UsersWsResponse response = tester.wsClient().permissions().users(request); - Optional found = response.getUsersList().stream() + Permissions.UsersWsResponse response = tester.wsClient().permissions().users(request); + Optional found = response.getUsersList().stream() .filter(u -> user.getLogin().equals(u.getLogin())) .findFirst(); return found.isPresent(); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java index 27c5b610d6e..3a9da8f55a0 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java @@ -26,7 +26,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.client.permission.AddGroupWsRequest; import org.sonarqube.ws.client.permission.AddUserWsRequest; import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java b/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java index ab19828ace4..601e98ceb16 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java @@ -33,7 +33,7 @@ import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.LogsTailer; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.ce.ActivityStatusWsRequest; +import org.sonarqube.ws.client.ce.ActivityStatusRequest; import util.ItUtils; import static com.google.common.base.Preconditions.checkState; @@ -142,7 +142,7 @@ public class CeShutdownTest { } int countInProgressTasks() { - return adminWsClient.ce().activityStatus(ActivityStatusWsRequest.newBuilder().build()).getInProgress(); + return adminWsClient.ce().activityStatus(new ActivityStatusRequest()).getInProgress(); } boolean hasTaskFinishedSuccessfully() throws Exception { diff --git a/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java b/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java index 64d0625e192..25090a55def 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java @@ -45,10 +45,11 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.ce.ActivityWsRequest; +import org.sonarqube.ws.client.ce.ActivityRequest; import util.ItUtils; import static com.google.common.collect.ImmutableSet.copyOf; @@ -129,7 +130,7 @@ public class CeWorkersTest { waitForEmptyQueue(); - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("OOM") .setStatus(ImmutableList.of("FAILED"))) .getTasksCount()) @@ -139,7 +140,7 @@ public class CeWorkersTest { waitForEmptyQueue(); - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("OK") .setStatus(ImmutableList.of("SUCCESS"))) .getTasksCount()) @@ -149,7 +150,7 @@ public class CeWorkersTest { waitForEmptyQueue(); - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("ISE") .setStatus(ImmutableList.of("FAILED"))) .getTasksCount()) @@ -159,7 +160,7 @@ public class CeWorkersTest { waitForEmptyQueue(); - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("OK") .setStatus(ImmutableList.of("SUCCESS"))) .getTasksCount()) @@ -174,11 +175,11 @@ public class CeWorkersTest { @Test public void ce_worker_is_resilient_to_OOM_and_RuntimeException_when_starting_or_stopping_analysis_report_container() throws IOException { - int initSuccessReportTaskCount = adminWsClient.ce().activity(new ActivityWsRequest() + int initSuccessReportTaskCount = adminWsClient.ce().activity(new ActivityRequest() .setType("REPORT") .setStatus(ImmutableList.of("SUCCESS"))) .getTasksCount(); - int initFailedReportTaskCount = adminWsClient.ce().activity(new ActivityWsRequest() + int initFailedReportTaskCount = adminWsClient.ce().activity(new ActivityRequest() .setType("REPORT") .setStatus(ImmutableList.of("FAILED"))) .getTasksCount(); @@ -219,14 +220,14 @@ public class CeWorkersTest { orchestrator.executeBuild(sonarRunner, true); // failure while starting components does fail the tasks - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("REPORT") .setStatus(ImmutableList.of("FAILED"))) .getTasksCount()) .isEqualTo(initFailedReportTaskCount + 2); // failure while stopping components does not fail the tasks - assertThat(adminWsClient.ce().activity(new ActivityWsRequest() + assertThat(adminWsClient.ce().activity(new ActivityRequest() .setType("REPORT") .setStatus(ImmutableList.of("SUCCESS"))) .getTasksCount()) @@ -283,7 +284,7 @@ public class CeWorkersTest { private void verifyAnalysesRunInParallel(MappedByteBuffer mappedByteBuffer, int workerCount) { assertThat(adminWsClient.ce().workerCount()) - .extracting(WsCe.WorkerCountResponse::getValue, WsCe.WorkerCountResponse::getCanSetWorkerCount) + .extracting(Ce.WorkerCountResponse::getValue, Ce.WorkerCountResponse::getCanSetWorkerCount) .containsOnly(workerCount, true); blockAnyAnalysisWithFakeGovernancePlugin(mappedByteBuffer); @@ -296,18 +297,18 @@ public class CeWorkersTest { orchestrator.executeBuild(sonarRunner, false); } - List tasksList = waitForWsCallStatus( + List tasksList = waitForWsCallStatus( this::getTasksAllTasks, (tasks) -> verifyInProgressTaskCount(tasks, workerCount)); assertThat(tasksList.stream() .filter(CeWorkersTest::pending) - .map(WsCe.Task::getComponentKey) + .map(Ce.Task::getComponentKey) .collect(toSet())) .isEqualTo(copyOf(projectKeys.subList(workerCount, projectKeys.size()))); assertThat(tasksList.stream() .filter(CeWorkersTest::inProgress) - .map(WsCe.Task::getComponentKey) + .map(Ce.Task::getComponentKey) .collect(toSet())) .isEqualTo(copyOf(projectKeys.subList(0, workerCount))); @@ -336,20 +337,20 @@ public class CeWorkersTest { } } - private static boolean verifyInProgressTaskCount(List tasksList, int workerCount) { + private static boolean verifyInProgressTaskCount(List tasksList, int workerCount) { return tasksList.stream().filter(CeWorkersTest::inProgress).count() >= workerCount; } - private static boolean pending(WsCe.Task task) { - return WsCe.TaskStatus.PENDING == task.getStatus(); + private static boolean pending(Ce.Task task) { + return Ce.TaskStatus.PENDING == task.getStatus(); } - private static boolean inProgress(WsCe.Task task) { - return WsCe.TaskStatus.IN_PROGRESS == task.getStatus(); + private static boolean inProgress(Ce.Task task) { + return Ce.TaskStatus.IN_PROGRESS == task.getStatus(); } - private List getTasksAllTasks(WsClient wsClient) { - return wsClient.ce().activity(new ActivityWsRequest() + private List getTasksAllTasks(WsClient wsClient) { + return wsClient.ce().activity(new ActivityRequest() .setStatus(ImmutableList.of(STATUS_PENDING, STATUS_IN_PROGRESS))) .getTasksList(); } @@ -386,7 +387,7 @@ public class CeWorkersTest { int tasksCount; do { Thread.sleep(delay); - tasksCount = adminWsClient.ce().activity(new ActivityWsRequest() + tasksCount = adminWsClient.ce().activity(new ActivityRequest() .setStatus(ImmutableList.of("PENDING", "IN_PROGRESS"))) .getTasksCount(); i++; diff --git a/tests/src/test/java/org/sonarqube/tests/ce/CeWsTest.java b/tests/src/test/java/org/sonarqube/tests/ce/CeWsTest.java index e6faf6ec58c..aeeac87352e 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/CeWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/CeWsTest.java @@ -22,13 +22,15 @@ package org.sonarqube.tests.ce; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; -import org.sonarqube.tests.Category4Suite; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; -import org.sonarqube.ws.WsCe; +import org.sonarqube.tests.Category4Suite; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.ce.ActivityWsRequest; +import org.sonarqube.ws.client.ce.ActivityRequest; +import org.sonarqube.ws.client.ce.TaskRequest; import util.ItUtils; import static com.google.common.collect.Lists.newArrayList; @@ -52,25 +54,25 @@ public class CeWsTest { @Test public void activity() { - WsCe.ActivityResponse response = wsClient.ce().activity(new ActivityWsRequest() + Ce.ActivityResponse response = wsClient.ce().activity(new ActivityRequest() .setStatus(newArrayList("SUCCESS")) .setType("REPORT") - .setOnlyCurrents(true) - .setPage(1) - .setPageSize(100)); + .setOnlyCurrents(String.valueOf(true)) + .setP(String.valueOf(1)) + .setPs(String.valueOf(100))); assertThat(response).isNotNull(); assertThat(response.getTasksCount()).isGreaterThan(0); - WsCe.Task firstTask = response.getTasks(0); + Ce.Task firstTask = response.getTasks(0); assertThat(firstTask.getId()).isNotEmpty(); } @Test public void task() { - WsCe.TaskResponse taskResponse = wsClient.ce().task(taskUuid); + Ce.TaskResponse taskResponse = wsClient.ce().task(new TaskRequest().setId(taskUuid)); assertThat(taskResponse.hasTask()).isTrue(); - WsCe.Task task = taskResponse.getTask(); + Ce.Task task = taskResponse.getTask(); assertThat(task.getId()).isEqualTo(taskUuid); assertThat(task.hasErrorMessage()).isFalse(); assertThat(task.hasHasScannerContext()).isTrue(); @@ -79,7 +81,7 @@ public class CeWsTest { @Test public void task_types() { - WsCe.TaskTypesWsResponse response = wsClient.ce().taskTypes(); + Ce.TaskTypesWsResponse response = wsClient.ce().taskTypes(); assertThat(response).isNotNull(); assertThat(response.getTaskTypesCount()).isGreaterThan(0); diff --git a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java index 411c753b9bd..ed6f9c9f82f 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java @@ -44,8 +44,8 @@ import org.junit.Test; import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsProjects; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddUserWsRequest; @@ -102,12 +102,12 @@ public class ReportFailureNotificationTest { @Test public void send_notification_on_report_processing_failures_to_global_and_project_subscribers() throws Exception { Organizations.Organization organization = tester.organizations().getDefaultOrganization(); - WsUsers.CreateWsResponse.User user1 = tester.users().generateMember(organization, t -> t.setPassword("user1").setEmail("user1@bar.com")); - WsUsers.CreateWsResponse.User user2 = tester.users().generateMember(organization, t -> t.setPassword("user2").setEmail("user2@bar.com")); - WsUsers.CreateWsResponse.User user3 = tester.users().generateMember(organization, t -> t.setPassword("user3").setEmail("user3@bar.com")); - WsProjects.CreateWsResponse.Project project1 = tester.projects().generate(organization, t -> t.setName("Project1")); - WsProjects.CreateWsResponse.Project project2 = tester.projects().generate(organization, t -> t.setName("Project2")); - WsProjects.CreateWsResponse.Project project3 = tester.projects().generate(organization, t -> t.setName("Project3")); + Users.CreateWsResponse.User user1 = tester.users().generateMember(organization, t -> t.setPassword("user1").setEmail("user1@bar.com")); + Users.CreateWsResponse.User user2 = tester.users().generateMember(organization, t -> t.setPassword("user2").setEmail("user2@bar.com")); + Users.CreateWsResponse.User user3 = tester.users().generateMember(organization, t -> t.setPassword("user3").setEmail("user3@bar.com")); + Projects.CreateWsResponse.Project project1 = tester.projects().provision(organization, t -> t.setName("Project1")); + Projects.CreateWsResponse.Project project2 = tester.projects().provision(organization, t -> t.setName("Project2")); + Projects.CreateWsResponse.Project project3 = tester.projects().provision(organization, t -> t.setName("Project3")); // user 1 is admin of project 1 and will subscribe to global notifications tester.wsClient().permissions().addUser(new AddUserWsRequest() .setLogin(user1.getLogin()) @@ -177,7 +177,7 @@ public class ReportFailureNotificationTest { assertThat(waitForEmails()).isEmpty(); } - private static void assertSubjectAndContent(WsProjects.CreateWsResponse.Project project, List messages) { + private static void assertSubjectAndContent(Projects.CreateWsResponse.Project project, List messages) { assertThat(messages.stream().map(toSubject()).collect(Collectors.toSet())) .containsOnly("[SONARQUBE] " + project.getName() + ": Background task in failure"); Set content = messages.stream().map(toContent()).collect(Collectors.toSet()); @@ -221,7 +221,7 @@ public class ReportFailureNotificationTest { }; } - private void subscribeToReportFailures(WsUsers.CreateWsResponse.User user1, String password, @Nullable WsProjects.CreateWsResponse.Project project) { + private void subscribeToReportFailures(Users.CreateWsResponse.User user1, String password, @Nullable Projects.CreateWsResponse.Project project) { WsClient wsClient = newUserWsClient(orchestrator, user1.getLogin(), password); PostRequest request = new PostRequest("api/notifications/add") .setParam("type", "CeReportTaskFailure") @@ -233,7 +233,7 @@ public class ReportFailureNotificationTest { .failIfNotSuccessful(); } - private void unsubscribeFromReportFailures(WsUsers.CreateWsResponse.User user1, String password, @Nullable WsProjects.CreateWsResponse.Project project) { + private void unsubscribeFromReportFailures(Users.CreateWsResponse.User user1, String password, @Nullable Projects.CreateWsResponse.Project project) { WsClient wsClient = newUserWsClient(orchestrator, user1.getLogin(), password); PostRequest request = new PostRequest("api/notifications/remove") .setParam("type", "CeReportTaskFailure") @@ -245,7 +245,7 @@ public class ReportFailureNotificationTest { .failIfNotSuccessful(); } - private void executeAnalysis(WsProjects.CreateWsResponse.Project project) { + private void executeAnalysis(Projects.CreateWsResponse.Project project) { SonarScanner sonarScanner = SonarScanner.create(projectDir("shared/xoo-sample"), "sonar.projectKey", project.getKey(), "sonar.projectName", project.getName()); diff --git a/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java b/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java index feb667dce65..3d0b3c8ab02 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Common; -import org.sonarqube.ws.WsBranches; +import org.sonarqube.ws.ProjectBranches; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import util.ItUtils; @@ -47,10 +47,10 @@ public class BranchTest { public void list_branches_contains_main_branch() { runProjectAnalysis(orchestrator, "shared/xoo-sample"); - WsBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample"); + ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample"); assertThat(result.getBranchesList()) - .extracting(WsBranches.Branch::getName, WsBranches.Branch::getType, WsBranches.Branch::getIsMain) + .extracting(ProjectBranches.Branch::getName, ProjectBranches.Branch::getType, ProjectBranches.Branch::getIsMain) .containsExactlyInAnyOrder(Tuple.tuple("master", Common.BranchType.LONG, true)); } diff --git a/tests/src/test/java/org/sonarqube/tests/component/CodePageTest.java b/tests/src/test/java/org/sonarqube/tests/component/CodePageTest.java index 1f1b33f5ae6..ef121b74fc6 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/CodePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/CodePageTest.java @@ -25,7 +25,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import static util.ItUtils.projectDir; @@ -39,7 +39,7 @@ public class CodePageTest { @Test public void code_page() { - Project project = tester.projects().generate(null); + Project project = tester.projects().provision(); executeAnalysis(project); tester.openBrowser().openCode(project.getKey()) @@ -64,7 +64,7 @@ public class CodePageTest { @Test public void expand_root_dir() { - Project project = tester.projects().generate(null); + Project project = tester.projects().provision(); executeAnalysis(project, "shared/xoo-sample-with-root-dir"); tester.openBrowser().openCode(project.getKey()) diff --git a/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java b/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java index 2e9ccdd7819..81a621d0e05 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java @@ -26,7 +26,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsComponents; +import org.sonarqube.ws.Components; import org.sonarqube.ws.client.component.SearchWsRequest; import org.sonarqube.ws.client.component.ShowWsRequest; @@ -53,7 +53,7 @@ public class ComponentsWsTest { @Test public void show() { - WsComponents.ShowWsResponse response = tester.wsClient().components().show(new ShowWsRequest().setKey(FILE_KEY)); + Components.ShowWsResponse response = tester.wsClient().components().show(new ShowWsRequest().setKey(FILE_KEY)); assertThat(response).isNotNull(); assertThat(response.getComponent().getKey()).isEqualTo(FILE_KEY); @@ -62,7 +62,7 @@ public class ComponentsWsTest { @Test public void search() { - WsComponents.SearchWsResponse response = tester.wsClient().components().search(new SearchWsRequest() + Components.SearchWsResponse response = tester.wsClient().components().search(new SearchWsRequest() .setQualifiers(singletonList("FIL"))); assertThat(response).isNotNull(); diff --git a/tests/src/test/java/org/sonarqube/tests/duplication/NewDuplicationsTest.java b/tests/src/test/java/org/sonarqube/tests/duplication/NewDuplicationsTest.java index 76b6a277a55..9e8d41bf9a1 100644 --- a/tests/src/test/java/org/sonarqube/tests/duplication/NewDuplicationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/duplication/NewDuplicationsTest.java @@ -27,7 +27,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import static java.lang.Double.parseDouble; import static org.assertj.core.api.Assertions.assertThat; @@ -57,7 +57,7 @@ public class NewDuplicationsTest { @Test public void new_duplications_on_project() throws Exception { - Map measures = getMeasures("new-duplications"); + Map measures = getMeasures("new-duplications"); assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(83d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(71d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(85.5d, DEFAULT_OFFSET); @@ -66,7 +66,7 @@ public class NewDuplicationsTest { @Test public void new_duplications_on_directory() throws Exception { - Map measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_with_other_dir1"); + Map measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_with_other_dir1"); assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(24d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(24d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(100d, DEFAULT_OFFSET); @@ -75,14 +75,14 @@ public class NewDuplicationsTest { @Test public void new_duplications_on_file() throws Exception { - Map measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo"); + Map measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo"); assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(41d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(29d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(70.7d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_duplicated_blocks").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(2d, DEFAULT_OFFSET); } - private static Map getMeasures(String key) { + private static Map getMeasures(String key) { return getMeasuresWithVariationsByMetricKey(orchestrator, key, "new_lines", "new_duplicated_lines", "new_duplicated_lines_density", "new_duplicated_blocks"); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/AutoAssignTest.java b/tests/src/test/java/org/sonarqube/tests/issue/AutoAssignTest.java index d3b76382b4f..89d0628ca73 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/AutoAssignTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/AutoAssignTest.java @@ -30,7 +30,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.wsclient.issue.Issue; import org.sonar.wsclient.issue.IssueQuery; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.user.CreateRequest; @@ -191,7 +191,7 @@ public class AutoAssignTest extends AbstractIssueTest { private static void deleteAllUsers() { WsClient wsClient = newAdminWsClient(ORCHESTRATOR); - WsUsers.SearchWsResponse searchResponse = wsClient.users().search(SearchRequest.builder().build()); + Users.SearchWsResponse searchResponse = wsClient.users().search(SearchRequest.builder().build()); searchResponse.getUsersList().forEach(user -> { wsClient.wsConnector().call(new PostRequest("api/users/deactivate").setParam("login", user.getLogin())); }); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java index fbeeb637d60..b5bcef07954 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java @@ -44,10 +44,10 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.Issues.SearchWsResponse; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.issue.AssignRequest; @@ -289,8 +289,8 @@ public class IssueNotificationsTest { private void createSampleProject(String visibility) { // Create project - QualityProfiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization); - Project project = tester.projects().generate(organization, p -> p.setKey(PROJECT_KEY) + Qualityprofiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization); + Project project = tester.projects().provision(organization, p -> p.setKey(PROJECT_KEY) .setName("Sample") .setVisibility(visibility)); tester.qProfiles() @@ -387,7 +387,7 @@ public class IssueNotificationsTest { }).collect(Collectors.toList()); } - private void addNotificationsTo(WsUsers.CreateWsResponse.User user) { + private void addNotificationsTo(Users.CreateWsResponse.User user) { // Add notifications to the test user WsClient wsClient = tester.as(user.getLogin()).wsClient(); wsClient.wsConnector().call(new PostRequest("api/notifications/add") diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java index c44fcafaf73..e802dc945ac 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java @@ -31,7 +31,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.issue.SearchWsRequest; import org.sonarqube.ws.client.permission.AddUserWsRequest; import org.sonarqube.ws.client.project.CreateRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java b/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java index 7b6c4c79f9f..d9df5202424 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java @@ -25,8 +25,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.sonar.wsclient.issue.IssueQuery; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Measure; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Measure; import util.ItUtils; import static java.lang.Integer.parseInt; @@ -111,7 +111,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); Map measures = getMeasuresWithVariationsByMetricKey(ORCHESTRATOR, "sample", "new_violations", "violations", "ncloc"); - assertThat(measures.get("new_violations").getPeriods().getPeriodsValueList()).extracting(WsMeasures.PeriodValue::getValue).containsOnly("17"); + assertThat(measures.get("new_violations").getPeriods().getPeriodsValueList()).extracting(Measures.PeriodValue::getValue).containsOnly("17"); Measure violations = measures.get("violations"); assertThat(parseInt(violations.getValue())).isEqualTo(43); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java index 8ca101b9fee..db359df1056 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java @@ -32,7 +32,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.issue.AssignRequest; import org.sonarqube.ws.client.issue.BulkChangeRequest; import org.sonarqube.ws.client.issue.SearchWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java index 13e7c26f8c3..c7feefc3a58 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java @@ -29,7 +29,7 @@ import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import util.issue.IssueRule; import static util.ItUtils.restoreProfile; @@ -48,8 +48,8 @@ public class OrganizationIssuesPageTest { private Organizations.Organization org1; private Organizations.Organization org2; - private WsUsers.CreateWsResponse.User user1; - private WsUsers.CreateWsResponse.User user2; + private Users.CreateWsResponse.User user1; + private Users.CreateWsResponse.User user2; @Before public void setUp() throws Exception { @@ -81,7 +81,7 @@ public class OrganizationIssuesPageTest { } private String provisionProject(Organizations.Organization organization) { - return tester.projects().generate(organization).getKey(); + return tester.projects().provision(organization).getKey(); } private void analyseProject(String projectKey, String organization) { diff --git a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java index d1acdb65188..66245b7259e 100644 --- a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java @@ -26,8 +26,8 @@ import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Measures; import org.sonarqube.ws.client.component.TreeWsRequest; import org.sonarqube.ws.client.issue.IssuesService; import org.sonarqube.ws.client.issue.SearchWsRequest; @@ -75,7 +75,7 @@ public class LiteTest { @Test public void call_components_ws() { // files in project - WsComponents.TreeWsResponse tree = tester.wsClient().components().tree(new TreeWsRequest() + Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeWsRequest() .setBaseComponentKey(PROJECT_KEY) .setQualifiers(singletonList("FIL"))); assertThat(tree.getComponentsCount()).isEqualTo(4); @@ -89,13 +89,13 @@ public class LiteTest { public void call_measures_ws() { // project measures MeasuresService measuresService = tester.wsClient().measures(); - WsMeasures.ComponentWsResponse component = measuresService.component(new ComponentWsRequest() + Measures.ComponentWsResponse component = measuresService.component(new ComponentWsRequest() .setComponentKey(PROJECT_KEY) .setMetricKeys(asList("lines", "ncloc", "files"))); assertThat(component.getComponent().getMeasuresCount()).isEqualTo(3); // file measures - WsMeasures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeWsRequest() + Measures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeWsRequest() .setBaseComponentKey(PROJECT_KEY) .setQualifiers(singletonList("FIL")) .setMetricKeys(asList("lines", "ncloc"))); diff --git a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java index e7718f11b36..e83ab8f5c8a 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java @@ -27,9 +27,9 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse; -import org.sonarqube.ws.WsMeasures.ComponentWsResponse; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures.ComponentWsResponse; import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; import org.sonarqube.ws.client.measure.ComponentWsRequest; @@ -67,7 +67,7 @@ public class MeasuresWsTest { assertThat(response).isNotNull(); assertThat(response.getBaseComponent().getKey()).isEqualTo("sample"); assertThat(response.getMetrics().getMetricsList()).extracting("key").containsOnly("ncloc"); - List components = response.getComponentsList(); + List components = response.getComponentsList(); assertThat(components).hasSize(2).extracting("key").containsOnly(DIR_KEY, FILE_KEY); assertThat(components.get(0).getMeasuresList().get(0).getValue()).isEqualTo("13"); } @@ -142,7 +142,7 @@ public class MeasuresWsTest { .setMetricKeys(singletonList("ncloc")) .setAdditionalFields(newArrayList("metrics", "periods"))); - WsMeasures.Component component = response.getComponent(); + Measures.Component component = response.getComponent(); assertThat(component.getKey()).isEqualTo("sample"); assertThat(component.getMeasuresList()).isNotEmpty(); assertThat(response.getMetrics().getMetricsList()).extracting("key").containsOnly("ncloc"); diff --git a/tests/src/test/java/org/sonarqube/tests/measure/SincePreviousVersionHistoryTest.java b/tests/src/test/java/org/sonarqube/tests/measure/SincePreviousVersionHistoryTest.java index dede45c53ae..b73d878d87f 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/SincePreviousVersionHistoryTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/SincePreviousVersionHistoryTest.java @@ -33,8 +33,8 @@ import org.sonarqube.qa.util.Tester; import static java.lang.Integer.parseInt; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonarqube.ws.WsMeasures.Measure; -import static org.sonarqube.ws.WsMeasures.PeriodValue; +import static org.sonarqube.ws.Measures.Measure; +import static org.sonarqube.ws.Measures.PeriodValue; import static util.ItUtils.getLeakPeriodValue; import static util.ItUtils.getMeasureWithVariation; import static util.ItUtils.projectDir; diff --git a/tests/src/test/java/org/sonarqube/tests/measure/SinceXDaysHistoryTest.java b/tests/src/test/java/org/sonarqube/tests/measure/SinceXDaysHistoryTest.java index c030f301e0b..93869338c12 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/SinceXDaysHistoryTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/SinceXDaysHistoryTest.java @@ -30,7 +30,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import util.ItUtils; import static java.lang.Integer.parseInt; @@ -87,7 +87,7 @@ public class SinceXDaysHistoryTest { } private void checkMeasure(String metric, int variation) { - WsMeasures.Measure measure = getMeasureWithVariation(orchestrator, PROJECT, metric); + Measures.Measure measure = getMeasureWithVariation(orchestrator, PROJECT, metric); assertThat(measure.getPeriods().getPeriodsValueList()).extracting(periodValue -> parseInt(periodValue.getValue())).containsOnly(variation); } diff --git a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java index 34b9f0dbc18..41ed941920c 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java @@ -29,9 +29,9 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures.Measure; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse; -import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue; +import org.sonarqube.ws.Measures.Measure; +import org.sonarqube.ws.Measures.SearchHistoryResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue; import org.sonarqube.ws.client.measure.SearchHistoryRequest; import util.ItUtils; import util.ItUtils.ComponentNavigation; diff --git a/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java b/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java index 911305356e2..33c6de854b8 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java @@ -30,9 +30,10 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; +import org.sonarqube.ws.client.ce.TaskRequest; import org.sonarqube.ws.client.organization.UpdateProjectVisibilityWsRequest; import org.sonarqube.ws.client.project.CreateRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; @@ -40,7 +41,7 @@ import util.ItUtils; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonarqube.ws.WsCe.TaskResponse; +import static org.sonarqube.ws.Ce.TaskResponse; import static util.ItUtils.expectHttpError; import static util.ItUtils.newProjectKey; import static util.ItUtils.projectDir; @@ -76,7 +77,7 @@ public class BillingTest { String taskUuid = executeAnalysis(newProjectKey()); - TaskResponse taskResponse = tester.wsClient().ce().task(taskUuid); + TaskResponse taskResponse = tester.wsClient().ce().task(new TaskRequest().setId(taskUuid)); assertThat(taskResponse.getTask().hasErrorMessage()).isFalse(); } @@ -86,7 +87,7 @@ public class BillingTest { String taskUuid = executeAnalysis(newProjectKey()); - TaskResponse taskResponse = tester.wsClient().ce().task(taskUuid); + TaskResponse taskResponse = tester.wsClient().ce().task(new TaskRequest().setId(taskUuid)); assertThat(taskResponse.getTask().hasErrorMessage()).isTrue(); assertThat(taskResponse.getTask().getErrorMessage()).contains(format("Organization %s cannot perform analysis", organization.getKey())); } @@ -211,7 +212,7 @@ public class BillingTest { } private String createPublicProject() { - return tester.projects().generate(organization).getKey(); + return tester.projects().provision(organization).getKey(); } private String executeAnalysis(String projectKey) { diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java index 7968fe4d50a..2b738c24afd 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.permission.AddUserWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java index 36064dd20f3..e909fd2d810 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.organization.MembersPage; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; public class OrganizationMembershipUiTest { diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java index 158516a3ff9..fbf6725f48f 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java @@ -27,16 +27,15 @@ import org.junit.After; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.sonarqube.qa.util.OrganizationTester; import org.sonarqube.qa.util.Tester; +import org.sonarqube.ws.Components; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles; +import org.sonarqube.ws.Qualityprofiles; import org.sonarqube.ws.Rules; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsUserGroups.Group; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.UserGroups.Group; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.component.ComponentsService; import org.sonarqube.ws.client.organization.CreateWsRequest; import org.sonarqube.ws.client.organization.OrganizationService; @@ -53,28 +52,25 @@ import static util.ItUtils.expectForbiddenError; import static util.ItUtils.expectNotFoundError; import static util.ItUtils.expectUnauthorizedError; import static util.ItUtils.runProjectAnalysis; -import static util.ItUtils.setServerProperty; public class OrganizationTest { private static final String SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS = "sonar.organizations.anyoneCanCreate"; private static final String DEFAULT_ORGANIZATION_KEY = "default-organization"; private static final String NAME = "Foo Company"; - // private static final String KEY = "foo-company"; private static final String DESCRIPTION = "the description of Foo company"; private static final String URL = "https://www.foo.fr"; private static final String AVATAR_URL = "https://www.foo.fr/corporate_logo.png"; @ClassRule public static Orchestrator orchestrator = OrganizationSuite.ORCHESTRATOR; + @Rule public Tester tester = new Tester(orchestrator); - @Rule - public ExpectedException expectedException = ExpectedException.none(); @After public void tearDown() { - setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, null); + tester.settings().resetSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS); } @Test @@ -272,22 +268,22 @@ public class OrganizationTest { Group group = tester.groups().generate(organization); tester.groups().addMemberToGroups(organization, user.getLogin(), group.getName()); - List memberOfGroups = tester.groups().getGroupsOfUser(organization, user.getLogin()); + List memberOfGroups = tester.groups().getGroupsOfUser(organization, user.getLogin()); - assertThat(memberOfGroups).extracting(WsUsers.GroupsWsResponse.Group::getName) + assertThat(memberOfGroups).extracting(Users.GroupsWsResponse.Group::getName) .containsExactlyInAnyOrder(group.getName(), "Members"); } @Test public void anonymous_cannot_create_organizations_even_if_anyone_is_allowed_to() { - setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true"); + tester.settings().setGlobalSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true"); expectUnauthorizedError(() -> tester.asAnonymous().organizations().generate()); } @Test public void logged_in_user_can_create_organizations_if_anyone_is_allowed_to() { - setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true"); + tester.settings().setGlobalSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true"); User user = tester.users().generate(); Organization organization = tester.as(user.getLogin()).organizations().generate(); @@ -302,7 +298,7 @@ public class OrganizationTest { .hasSize(1); } - private WsComponents.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) { + private Components.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) { return componentsService .search(new org.sonarqube.ws.client.component.SearchWsRequest() .setOrganization(organizationKey) @@ -316,7 +312,7 @@ public class OrganizationTest { } private void verifyOrganization(Organization createdOrganization, String name, String description, String url, - String avatarUrl) { + String avatarUrl) { SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(createdOrganization.getKey()).build(); List result = tester.organizations().service().search(request).getOrganizationsList(); assertThat(result).hasSize(1); @@ -343,7 +339,7 @@ public class OrganizationTest { private void assertThatBuiltInQualityProfilesExist(Organization org) { org.sonarqube.ws.client.qualityprofile.SearchWsRequest profilesRequest = new org.sonarqube.ws.client.qualityprofile.SearchWsRequest() .setOrganizationKey(org.getKey()); - QualityProfiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest); + Qualityprofiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest); assertThat(response.getProfilesCount()).isGreaterThan(0); response.getProfilesList().forEach(p -> { diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationWebExtensionsTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationWebExtensionsTest.java index 6387a8ee001..f0722be9f33 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationWebExtensionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationWebExtensionsTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.openqa.selenium.By; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import static com.codeborne.selenide.Condition.text; import static com.codeborne.selenide.Selenide.$; diff --git a/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java b/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java index 5c421aaf580..a31f889a890 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java @@ -22,18 +22,16 @@ package org.sonarqube.tests.organization; import com.sonar.orchestrator.Orchestrator; import java.util.List; -import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.organization.SearchWsRequest; import static org.assertj.core.api.Assertions.assertThat; -import static util.ItUtils.setServerProperty; public class PersonalOrganizationTest { @@ -47,21 +45,16 @@ public class PersonalOrganizationTest { @Before public void setUp() { - setServerProperty(orchestrator, SETTING_CREATE_PERSONAL_ORG, "true"); - } - - @After - public void tearDown() { - setServerProperty(orchestrator, SETTING_CREATE_PERSONAL_ORG, null); + tester.settings().setGlobalSettings(SETTING_CREATE_PERSONAL_ORG, "true"); } @Test public void personal_organizations_are_created_for_new_users() { - WsUsers.CreateWsResponse.User user = tester.users().generate(); + Users.CreateWsResponse.User user = tester.users().generate(); List existing = tester.wsClient().organizations().search(SearchWsRequest.builder().build()).getOrganizationsList(); assertThat(existing) - .filteredOn(o -> o.getGuarded()) + .filteredOn(Organizations.Organization::getGuarded) .filteredOn(o -> o.getKey().equals(user.getLogin())) .hasSize(1) .matches(l -> l.get(0).getName().equals(user.getName())); diff --git a/tests/src/test/java/org/sonarqube/tests/organization/RootUserTest.java b/tests/src/test/java/org/sonarqube/tests/organization/RootUserTest.java index 2a7d0d3f8bc..18451b12339 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/RootUserTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/RootUserTest.java @@ -26,8 +26,8 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.TesterSession; -import org.sonarqube.ws.WsRoot; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Root; +import org.sonarqube.ws.Users; import util.user.UserRule; import static org.assertj.core.api.Assertions.assertThat; @@ -45,17 +45,17 @@ public class RootUserTest { @Test public void system_administrator_is_flagged_as_root_when_he_enables_organization_support() { assertThat(tester.wsClient().roots().search().getRootsList()) - .extracting(WsRoot.Root::getLogin) + .extracting(Root.RootContent::getLogin) .containsExactly(UserRule.ADMIN_LOGIN); } @Test public void a_root_can_flag_other_user_as_root() { - WsUsers.CreateWsResponse.User user = tester.users().generate(); + Users.CreateWsResponse.User user = tester.users().generate(); tester.wsClient().roots().setRoot(user.getLogin()); assertThat(tester.wsClient().roots().search().getRootsList()) - .extracting(WsRoot.Root::getLogin) + .extracting(Root.RootContent::getLogin) .containsExactlyInAnyOrder(UserRule.ADMIN_LOGIN, user.getLogin()); } @@ -66,8 +66,8 @@ public class RootUserTest { @Test public void root_can_be_set_and_unset_via_web_services() { - WsUsers.CreateWsResponse.User user1 = tester.users().generate(); - WsUsers.CreateWsResponse.User user2 = tester.users().generate(); + Users.CreateWsResponse.User user1 = tester.users().generate(); + Users.CreateWsResponse.User user2 = tester.users().generate(); TesterSession user1Session = tester.as(user1.getLogin()); TesterSession user2Session = tester.as(user2.getLogin()); diff --git a/tests/src/test/java/org/sonarqube/tests/performance/AbstractPerfTest.java b/tests/src/test/java/org/sonarqube/tests/performance/AbstractPerfTest.java index 67f05db0964..7d3bc262e16 100644 --- a/tests/src/test/java/org/sonarqube/tests/performance/AbstractPerfTest.java +++ b/tests/src/test/java/org/sonarqube/tests/performance/AbstractPerfTest.java @@ -27,9 +27,7 @@ import java.io.IOException; import java.util.Properties; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.hamcrest.CustomMatcher; import org.junit.Rule; -import org.junit.rules.ErrorCollector; import org.junit.rules.TestName; import static org.assertj.core.api.Assertions.assertThat; @@ -46,34 +44,11 @@ public abstract class AbstractPerfTest { assertThat(Math.abs(variation)).as(String.format("Expected %d ms, got %d ms", expectedDuration, duration)).isLessThan(ACCEPTED_DURATION_VARIATION_IN_PERCENTS); } - protected void assertDurationAround(ErrorCollector collector, long duration, long expectedDuration) { - double variation = 100.0 * (0.0 + duration - expectedDuration) / expectedDuration; - System.out.printf("Test %s : executed in %d ms (%.2f %% from target)\n", testName.getMethodName(), duration, variation); - collector.checkThat(String.format("Expected %d ms, got %d ms", expectedDuration, duration), Math.abs(variation), new CustomMatcher("a value less than " - + ACCEPTED_DURATION_VARIATION_IN_PERCENTS) { - @Override - public boolean matches(Object item) { - return ((item instanceof Double) && ((Double) item).compareTo(ACCEPTED_DURATION_VARIATION_IN_PERCENTS) < 0); - } - }); - } - protected void assertDurationLessThan(long duration, long maxDuration) { System.out.printf("Test %s : %d ms (max allowed is %d)\n", testName.getMethodName(), duration, maxDuration); assertThat(duration).as(String.format("Expected less than %d ms, got %d ms", maxDuration, duration)).isLessThanOrEqualTo(maxDuration); } - protected void assertDurationLessThan(ErrorCollector collector, long duration, final long maxDuration) { - System.out.printf("Test %s : %d ms (max allowed is %d)\n", testName.getMethodName(), duration, maxDuration); - collector.checkThat(String.format("Expected less than %d ms, got %d ms", maxDuration, duration), duration, new CustomMatcher("a value less than " - + maxDuration) { - @Override - public boolean matches(Object item) { - return ((item instanceof Long) && ((Long) item).compareTo(maxDuration) < 0); - } - }); - } - protected Properties readProfiling(File baseDir, String moduleKey) throws IOException { File profilingFile = new File(baseDir, ".sonar/profiling/" + moduleKey + "-profiler.properties"); Properties props = new Properties(); diff --git a/tests/src/test/java/org/sonarqube/tests/performance/PerfRule.java b/tests/src/test/java/org/sonarqube/tests/performance/PerfRule.java index 7b12d79bd38..1887d1aaba9 100644 --- a/tests/src/test/java/org/sonarqube/tests/performance/PerfRule.java +++ b/tests/src/test/java/org/sonarqube/tests/performance/PerfRule.java @@ -20,22 +20,20 @@ package org.sonarqube.tests.performance; import com.google.common.base.Joiner; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.hamcrest.CustomMatcher; import org.junit.rules.ErrorCollector; import org.junit.runner.Description; import org.junit.runners.model.Statement; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public abstract class PerfRule extends ErrorCollector { private final int runCount; - private final List> recordedResults = new ArrayList>(); + private final List> recordedResults = new ArrayList<>(); private int currentRun; - private String testName; public PerfRule(int runCount) { this.runCount = runCount; @@ -43,12 +41,11 @@ public abstract class PerfRule extends ErrorCollector { @Override public Statement apply(final Statement base, Description description) { - this.testName = description.getMethodName(); return new Statement() { @Override public void evaluate() throws Throwable { for (currentRun = 1; currentRun <= runCount; currentRun++) { - recordedResults.add(new ArrayList()); + recordedResults.add(new ArrayList<>()); beforeEachRun(); base.evaluate(); } @@ -66,6 +63,7 @@ public abstract class PerfRule extends ErrorCollector { long meanDuration = computeAverageDurationOfCurrentStep(); double variation = 100.0 * (0.0 + meanDuration - expectedDuration) / expectedDuration; checkThat(String.format("Expected %d ms in average, got %d ms [%s]", expectedDuration, meanDuration, Joiner.on(",").join(getAllResultsOfCurrentStep())), Math.abs(variation), + new CustomMatcher( "a value less than " + AbstractPerfTest.ACCEPTED_DURATION_VARIATION_IN_PERCENTS) { @@ -101,21 +99,6 @@ public abstract class PerfRule extends ErrorCollector { return recordedResults.get(currentRun - 1); } - public void assertDurationLessThan(long duration, final long maxDuration) { - currentResults().add(duration); - if (isLastRun()) { - long meanDuration = computeAverageDurationOfCurrentStep(); - checkThat(String.format("Expected less than %d ms in average, got %d ms [%s]", maxDuration, meanDuration, Joiner.on(",").join(getAllResultsOfCurrentStep())), meanDuration, - new CustomMatcher("a value less than " - + maxDuration) { - @Override - public boolean matches(Object item) { - return ((item instanceof Long) && ((Long) item).compareTo(maxDuration) < 0); - } - }); - } - } - private boolean isLastRun() { return currentRun == runCount; } diff --git a/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java b/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java index 4729fb331d8..6d18fec7152 100644 --- a/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java @@ -33,7 +33,7 @@ import org.junit.Test; import org.junit.rules.ErrorCollector; import org.junit.rules.TemporaryFolder; import org.sonarqube.tests.performance.AbstractPerfTest; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsClientFactories; @@ -85,7 +85,7 @@ public class DuplicationTest extends AbstractPerfTest { .setMetricKeys(asList("duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density"))) .getComponent().getMeasuresList() .stream() - .collect(Collectors.toMap(WsMeasures.Measure::getMetric, measure -> parseDouble(measure.getValue()))); + .collect(Collectors.toMap(Measures.Measure::getMetric, measure -> parseDouble(measure.getValue()))); } private WsClient newWsClient() { diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java index a040b04d25d..770e83b8192 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java @@ -25,7 +25,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.client.component.SearchProjectsRequest; import static com.codeborne.selenide.Condition.text; @@ -53,9 +53,9 @@ public class ProjectBulkDeletionPageTest { */ @Test public void bulk_deletion_on_selected_projects() throws Exception { - Project project1 = tester.projects().generate(null, t -> t.setName("Foo")); - Project project2 = tester.projects().generate(null, t -> t.setName("Bar")); - Project project3 = tester.projects().generate(null, t -> t.setName("FooQux")); + Project project1 = tester.projects().provision(p -> p.setName("Foo")); + Project project2 = tester.projects().provision(p -> p.setName("Bar")); + Project project3 = tester.projects().provision(p -> p.setName("FooQux")); tester.openBrowser().logIn().submitCredentials(sysAdminLogin).open("/organizations/default-organization/projects_management"); $("#projects-management-page").shouldHave(text(project1.getName())).shouldHave(text(project2.getName())).shouldHave(text(project3.getName())); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java index 559589ffc58..7036f46a69d 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java @@ -28,8 +28,8 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsProjects.CreateWsResponse; -import org.sonarqube.ws.WsProjects.SearchWsResponse.Component; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse.Component; import org.sonarqube.ws.client.project.SearchWsRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -46,9 +46,9 @@ public class ProjectBulkDeletionTest { @Test public void delete_projects() { Organizations.Organization organization = tester.organizations().generate(); - CreateWsResponse.Project firstProvisionedProject = tester.projects().generate(organization, p -> p.setKey("first-provisioned-project")); - CreateWsResponse.Project secondProvisionedProject = tester.projects().generate(organization, p -> p.setKey("second-provisioned-project")); - CreateWsResponse.Project analyzedProject = tester.projects().generate(organization); + CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization, p -> p.setKey("first-provisioned-project")); + CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization, p -> p.setKey("second-provisioned-project")); + CreateWsResponse.Project analyzedProject = tester.projects().provision(organization); analyzeProject(analyzedProject.getKey(), organization.getKey()); @@ -66,7 +66,7 @@ public class ProjectBulkDeletionTest { @Test public void delete_more_than_50_projects_at_the_same_time() { Organizations.Organization organization = tester.organizations().generate(); - IntStream.range(0, 60).forEach(i -> tester.projects().generate(organization)); + IntStream.range(0, 60).forEach(i -> tester.projects().provision(organization)); SearchWsRequest request = SearchWsRequest.builder().setOrganization(organization.getKey()).build(); assertThat(tester.wsClient().projects().search(request).getPaging().getTotal()).isEqualTo(60); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java index abd50a848cd..6495e142727 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java @@ -33,10 +33,10 @@ import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsProjects; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsResponse; @@ -78,7 +78,7 @@ public class ProjectDeletionTest { ItUtils.expectUnauthorizedError(() -> executeDeleteRequest(tester.asAnonymous().wsClient(), projectKey)); // fail if insufficient privilege - WsUsers.CreateWsResponse.User user = tester.users().generate(); + Users.CreateWsResponse.User user = tester.users().generate(); ItUtils.expectForbiddenError(() -> executeDeleteRequest(tester.as(user.getLogin()).wsClient(), projectKey)); // succeed to delete if administrator @@ -193,7 +193,7 @@ public class ProjectDeletionTest { * Projects administration page - uses database */ private boolean isInProjectsSearch(Organizations.Organization organization, String name) { - WsProjects.SearchWsResponse response = tester.wsClient().projects().search( + Projects.SearchWsResponse response = tester.wsClient().projects().search( SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build()); return response.getComponentsCount() > 0; } @@ -202,7 +202,7 @@ public class ProjectDeletionTest { * Projects page - api/components/search_projects - uses ES + DB */ private boolean isInComponentSearchProjects(String name) { - WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); return response.getComponentsCount() > 0; } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java index 69913864a08..95f4a73fdbc 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java @@ -32,8 +32,8 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Common; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; import org.sonarqube.ws.client.project.CreateRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java index 8a2c14f3806..b560d54c68f 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java @@ -34,9 +34,9 @@ import org.junit.rules.DisableOnDebug; import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.Tester; +import org.sonarqube.ws.Components; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsProjects; +import org.sonarqube.ws.Projects; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; @@ -71,7 +71,7 @@ public class ProjectKeyUpdateTest { public void update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - WsComponents.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder() @@ -86,10 +86,10 @@ public class ProjectKeyUpdateTest { public void bulk_update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - WsComponents.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); - WsProjects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder() + Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder() .setKey(PROJECT_KEY) .setFrom(PROJECT_KEY) .setTo(newProjectKey) @@ -98,14 +98,14 @@ public class ProjectKeyUpdateTest { assertThat(tester.wsClient().components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); assertThat(result.getKeysCount()).isEqualTo(1); assertThat(result.getKeys(0)) - .extracting(WsProjects.BulkUpdateKeyWsResponse.Key::getKey, WsProjects.BulkUpdateKeyWsResponse.Key::getNewKey, WsProjects.BulkUpdateKeyWsResponse.Key::getDuplicate) + .extracting(Projects.BulkUpdateKeyWsResponse.Key::getKey, Projects.BulkUpdateKeyWsResponse.Key::getNewKey, Projects.BulkUpdateKeyWsResponse.Key::getDuplicate) .containsOnlyOnce(PROJECT_KEY, newProjectKey, false); } @Test public void update_key_of_provisioned_project() { Organizations.Organization organization = tester.organizations().generate(); - WsProjects.CreateWsResponse.Project project = createProject(organization, "one", "Foo"); + Projects.CreateWsResponse.Project project = createProject(organization, "one", "Foo"); updateKey(project, "two"); @@ -120,7 +120,7 @@ public class ProjectKeyUpdateTest { @Test public void recover_indexing_errors_when_updating_key_of_provisioned_project() throws Exception { Organizations.Organization organization = tester.organizations().generate(); - WsProjects.CreateWsResponse.Project project = createProject(organization, "one", "Foo"); + Projects.CreateWsResponse.Project project = createProject(organization, "one", "Foo"); lockWritesOnProjectIndices(); @@ -228,7 +228,7 @@ public class ProjectKeyUpdateTest { tester.elasticsearch().unlockWrites("projectmeasures"); } - private void updateKey(WsProjects.CreateWsResponse.Project project, String newKey) { + private void updateKey(Projects.CreateWsResponse.Project project, String newKey) { tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(project.getKey()).setNewKey(newKey).build()); } @@ -236,7 +236,7 @@ public class ProjectKeyUpdateTest { tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(initialKey).setNewKey(newKey).build()); } - private WsProjects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) { + private Projects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) { CreateRequest createRequest = CreateRequest.builder().setKey(key).setName(name).setOrganization(organization.getKey()).build(); return tester.wsClient().projects().create(createRequest).getProject(); } @@ -254,7 +254,7 @@ public class ProjectKeyUpdateTest { */ @CheckForNull private String keyInComponentSearchProjects(String name) { - WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); if (response.getComponentsCount() > 0) { return response.getComponents(0).getKey(); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java index 4efc15da144..b980b287381 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java @@ -32,7 +32,7 @@ import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectLinkItem; import org.sonarqube.qa.util.pageobjects.ProjectLinksPage; -import org.sonarqube.ws.WsProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks.CreateWsResponse; import org.sonarqube.ws.client.projectlinks.CreateWsRequest; import org.sonarqube.ws.client.projectlinks.DeleteWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java index 9f9b1a8b7a4..de8a6b65abc 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java @@ -30,9 +30,9 @@ import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsProjects; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; +import org.sonarqube.ws.Components; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; @@ -100,7 +100,7 @@ public class ProjectProvisioningTest { * Projects administration page - uses database */ private boolean isInProjectsSearch(Organizations.Organization organization, String name) { - WsProjects.SearchWsResponse response = tester.wsClient().projects().search( + Projects.SearchWsResponse response = tester.wsClient().projects().search( SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build()); return response.getComponentsCount() > 0; } @@ -109,7 +109,7 @@ public class ProjectProvisioningTest { * Projects page - api/components/search_projects - uses ES + DB */ private boolean isInComponentSearchProjects(String name) { - WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); return response.getComponentsCount() > 0; } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java index 69cc1a69cfd..65da3c02981 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java @@ -28,9 +28,9 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsProjects.CreateWsResponse; -import org.sonarqube.ws.WsProjects.SearchWsResponse; -import org.sonarqube.ws.WsProjects.SearchWsResponse.Component; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse.Component; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.project.SearchWsRequest; @@ -50,8 +50,8 @@ public class ProjectSearchTest { @Test public void search_old_projects() { Organizations.Organization organization = tester.organizations().generate(); - CreateWsResponse.Project oldProject = tester.projects().generate(organization); - CreateWsResponse.Project recentProject = tester.projects().generate(organization); + CreateWsResponse.Project oldProject = tester.projects().provision(organization); + CreateWsResponse.Project recentProject = tester.projects().provision(organization); Date now = new Date(); Date oneYearAgo = DateUtils.addDays(now, -365); Date moreThanOneYearAgo = DateUtils.addDays(now, -366); @@ -70,9 +70,9 @@ public class ProjectSearchTest { @Test public void search_on_key_query_partial_match_case_insensitive() { Organizations.Organization organization = tester.organizations().generate(); - CreateWsResponse.Project lowerCaseProject = tester.projects().generate(organization, p -> p.setKey("project-key")); - CreateWsResponse.Project upperCaseProject = tester.projects().generate(organization, p -> p.setKey("PROJECT-KEY")); - CreateWsResponse.Project anotherProject = tester.projects().generate(organization, p -> p.setKey("another-project")); + CreateWsResponse.Project lowerCaseProject = tester.projects().provision(organization, p -> p.setKey("project-key")); + CreateWsResponse.Project upperCaseProject = tester.projects().provision(organization, p -> p.setKey("PROJECT-KEY")); + CreateWsResponse.Project anotherProject = tester.projects().provision(organization, p -> p.setKey("another-project")); analyzeProject(lowerCaseProject.getKey(), organization.getKey()); analyzeProject(upperCaseProject.getKey(), organization.getKey()); @@ -92,9 +92,9 @@ public class ProjectSearchTest { @Test public void search_provisioned_projects() { Organizations.Organization organization = tester.organizations().generate(); - CreateWsResponse.Project firstProvisionedProject = tester.projects().generate(organization); - CreateWsResponse.Project secondProvisionedProject = tester.projects().generate(organization); - CreateWsResponse.Project analyzedProject = tester.projects().generate(organization); + CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization); + CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization); + CreateWsResponse.Project analyzedProject = tester.projects().provision(organization); analyzeProject(analyzedProject.getKey(), organization.getKey()); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectSettingsTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectSettingsTest.java new file mode 100644 index 00000000000..b6550028eb5 --- /dev/null +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectSettingsTest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests.project; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarScanner; +import java.io.UnsupportedEncodingException; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.openqa.selenium.By; +import org.sonarqube.qa.util.Tester; +import org.sonarqube.qa.util.pageobjects.Navigation; +import org.sonarqube.qa.util.pageobjects.settings.SettingsPage; + +import static com.codeborne.selenide.Selenide.$; +import static util.ItUtils.projectDir; + +public class ProjectSettingsTest { + + @ClassRule + public static Orchestrator orchestrator = ProjectSuite.ORCHESTRATOR; + + @Rule + public Tester tester = new Tester(orchestrator); + + private String adminUser; + + @Before + public void setUp() { + adminUser = tester.users().generateAdministratorOnDefaultOrganization().getLogin(); + } + + @Test + public void display_project_settings() { + analyzeSample(); + + SettingsPage page = tester.openBrowser() + .logIn() + .submitCredentials(adminUser) + .openSettings("sample") + .assertMenuContains("Analysis Scope") + .assertMenuContains("Category 1") + .assertMenuContains("project-only") + .assertMenuContains("Xoo") + .assertSettingDisplayed("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay"); + + page.openCategory("project-only") + .assertSettingDisplayed("prop_only_on_project"); + + page.openCategory("General") + .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "30") + .assertStringSettingValue("sonar.leak.period", "previous_version") + .assertBooleanSettingValue("sonar.dbcleaner.cleanDirectory", true) + .setStringValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48") + .assertStringSettingValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48"); + } + + /** + * Values set on project level must not appear on global level + */ + @Test + public void display_correct_global_setting() { + analyzeSample(); + Navigation nav = tester.openBrowser(); + SettingsPage page = nav.logIn() + .submitCredentials(adminUser) + .openSettings("sample") + .openCategory("Analysis Scope") + .assertSettingDisplayed("sonar.coverage.exclusions") + .setStringValue("sonar.coverage.exclusions", "foo") + .assertStringSettingValue("sonar.coverage.exclusions", "foo"); + nav.logOut(); + + // login as root + tester.wsClient().users().skipOnboardingTutorial(); + nav.logIn().submitCredentials("admin", "admin"); + $(".global-navbar-menu ").$(By.linkText("Administration")).click(); + page + .openCategory("Analysis Scope") + .assertSettingDisplayed("sonar.coverage.exclusions") + .assertStringSettingValue("sonar.coverage.exclusions", ""); + } + + @Test + public void display_module_settings() throws UnsupportedEncodingException { + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); + + tester.openBrowser().logIn().submitCredentials(adminUser) + .openSettings("com.sonarsource.it.samples:multi-modules-sample:module_a") + .assertMenuContains("Analysis Scope") + .assertSettingDisplayed("sonar.coverage.exclusions"); + } + + private void analyzeSample() { + SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample")) + .setProperty("sonar.cpd.exclusions", "**/*"); + orchestrator.executeBuild(scan); + } +} diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java index 65121e03c67..711ace6dd4e 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java @@ -26,6 +26,7 @@ import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; +import static util.ItUtils.pluginArtifact; import static util.ItUtils.xooPlugin; @RunWith(Suite.class) @@ -42,10 +43,11 @@ import static util.ItUtils.xooPlugin; ProjectsPageTest.class, ProjectProvisioningTest.class, ProjectSearchTest.class, + ProjectSettingsTest.class, ProjectVisibilityPageTest.class }) public class ProjectSuite { - public static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress()); + static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress()); @ClassRule public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() @@ -59,6 +61,9 @@ public class ProjectSuite { .addPlugin(xooPlugin()) + // for ProjectSettingsTest + .addPlugin(pluginArtifact("sonar-subcategories-plugin")) + .build(); } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java index 0c2c745f9f6..92699c3332c 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; -import org.sonarqube.ws.WsComponents; +import org.sonarqube.ws.Components; import org.sonarqube.ws.client.component.SearchProjectsRequest; import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; @@ -84,7 +84,7 @@ public class ProjectVisibilityPageTest { .createProject("foo", "foo", visibility) .shouldHaveProjectsCount(1); - WsComponents.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).components().searchProjects( + Components.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).components().searchProjects( SearchProjectsRequest.builder().build()); assertThat(response.getComponentsCount()).isEqualTo(1); assertThat(response.getComponents(0).getKey()).isEqualTo("foo"); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java index d0008cc0bd6..a18787080f5 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java @@ -29,7 +29,7 @@ import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; @@ -104,7 +104,7 @@ public class ProjectsPageTest { page.shouldHaveTotal(2).shouldDisplayAllProjectsWidthSort("-analysis_date"); // all projects by default for logged in user - WsUsers.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization(); + Users.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization(); page = nav.logIn().submitCredentials(administrator.getLogin()).openProjects(); page.shouldHaveTotal(2).shouldDisplayAllProjects(); @@ -156,7 +156,7 @@ public class ProjectsPageTest { @Test public void should_switch_between_perspectives() { - WsUsers.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization(); + Users.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization(); ProjectsPage page = tester.openBrowser() .logIn().submitCredentials(administrator.getLogin()) .openProjects(); diff --git a/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java b/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java deleted file mode 100644 index 2e2c5a4551d..00000000000 --- a/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.tests.projectAdministration; - -import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarScanner; -import java.io.UnsupportedEncodingException; -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.openqa.selenium.By; -import org.sonarqube.qa.util.Tester; -import org.sonarqube.qa.util.pageobjects.Navigation; -import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; -import org.sonarqube.qa.util.pageobjects.settings.SettingsPage; -import org.sonarqube.tests.Category1Suite; -import org.sonarqube.ws.WsPermissions; -import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; -import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; -import org.sonarqube.ws.client.permission.UsersWsRequest; - -import static com.codeborne.selenide.Selenide.$; -import static org.assertj.core.api.Assertions.assertThat; -import static util.ItUtils.projectDir; - -/** - * TODO to be split and moved to project package - */ -public class ProjectAdministrationTest { - - @ClassRule - public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Rule - public Tester tester = new Tester(orchestrator).disableOrganizations(); - - private Navigation nav = Navigation.create(orchestrator); - - private String adminUser; - - @Before - public void deleteAnalysisData() throws SQLException { - orchestrator.resetData(); - adminUser = tester.users().generateAdministrator().getLogin(); - } - - @Test - public void display_project_settings() throws UnsupportedEncodingException { - scanSample(null, null); - - SettingsPage page = nav.logIn().submitCredentials(adminUser).openSettings("sample") - .assertMenuContains("Analysis Scope") - .assertMenuContains("Category 1") - .assertMenuContains("DEV") - .assertMenuContains("project-only") - .assertMenuContains("Xoo") - .assertSettingDisplayed("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay"); - - page.openCategory("project-only") - .assertSettingDisplayed("prop_only_on_project"); - - page.openCategory("General") - .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "30") - .assertStringSettingValue("sonar.leak.period", "previous_version") - .assertBooleanSettingValue("sonar.dbcleaner.cleanDirectory", true) - .setStringValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48") - .assertStringSettingValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48"); - } - - @Test - public void display_correct_global_setting () throws UnsupportedEncodingException { - scanSample(null, null); - SettingsPage page = nav.logIn().submitCredentials(adminUser).openSettings("sample") - .openCategory("Analysis Scope") - .assertSettingDisplayed("sonar.coverage.exclusions") - .setStringValue("sonar.coverage.exclusions", "foo") - .assertStringSettingValue("sonar.coverage.exclusions", "foo"); - - $(".global-navbar-menu ").$(By.linkText("Administration")).click(); - page - .openCategory("Analysis Scope") - .assertSettingDisplayed("sonar.coverage.exclusions") - .assertStringSettingValue("sonar.coverage.exclusions", ""); - } - - @Test - public void display_module_settings() throws UnsupportedEncodingException { - orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); - - nav.logIn().submitCredentials(adminUser) - .openSettings("com.sonarsource.it.samples:multi-modules-sample:module_a") - .assertMenuContains("Analysis Scope") - .assertSettingDisplayed("sonar.coverage.exclusions"); - } - - @Test - public void bulk_apply_permission_template() { - String project = tester.projects().generate(null).getKey(); - String user = tester.users().generate().getLogin(); - tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest().setName("foo-template")); - tester.wsClient().permissions().addUserToTemplate( - new AddUserToTemplateWsRequest() - .setPermission("admin") - .setTemplateName("foo-template") - .setLogin(user)); - ProjectsManagementPage page = nav.logIn().submitCredentials(adminUser).openProjectsManagement(); - page.shouldHaveProject(project); - page.bulkApplyPermissionTemplate("foo-template"); - WsPermissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest() - .setProjectKey(project) - .setPermission("admin") - ); - assertThat(usersResponse.getUsersCount()).isEqualTo(1); - assertThat(usersResponse.getUsers(0).getLogin()).isEqualTo(user); - } - - private void scanSample(@Nullable String date, @Nullable String profile) { - SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample")) - .setProperty("sonar.cpd.exclusions", "**/*"); - if (date != null) { - scan.setProperty("sonar.projectDate", date); - } - if (profile != null) { - scan.setProfile(profile); - } - orchestrator.executeBuild(scan); - } -} diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java index d67581b28b7..e4f9bf3fd27 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java @@ -33,16 +33,16 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Ce; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; -import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest; -import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; +import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest; +import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest; import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.getMeasure; @@ -59,21 +59,20 @@ public class OrganizationQualityGateForSmallChangesetsTest { @Test public void do_not_fail_quality_gate_with_poor_LEAK_coverage_and_a_max_of_19_lines_of_NEW_code() throws Exception { Organizations.Organization organization = tester.organizations().generate(); - Project project = tester.projects().generate(organization); + Project project = tester.projects().provision(organization); CreateWsResponse qualityGate = tester.qGates().generate(); tester.qGates().associateProject(qualityGate, project); - WsQualityGates.CreateConditionWsResponse condition = tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate.getId()) - .setMetricKey("new_coverage") - .setOperator("LT") + Qualitygates.CreateConditionWsResponse condition = tester.wsClient().qualityGates().createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate.getId())) + .setMetric("new_coverage") + .setOp("LT") .setWarning("90") .setError("80") - .setPeriod(1) - .build()); + .setPeriod("1")); tester.settings().setProjectSetting(project.getKey(), "sonar.leak.period", "previous_version"); String password = "password1"; - WsUsers.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password)); + Users.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password)); // no leak => use usual behaviour SonarScanner analysis = SonarScanner @@ -106,14 +105,13 @@ public class OrganizationQualityGateForSmallChangesetsTest { assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", true); // small leak => if coverage is OK anyways, we do not have to ignore anything - tester.wsClient().qualityGates().updateCondition(UpdateConditionRequest.builder() - .setConditionId(condition.getId()) - .setMetricKey("new_coverage") - .setOperator("LT") + tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest() + .setId(String.valueOf(condition.getId())) + .setMetric("new_coverage") + .setOp("LT") .setWarning("10") .setError("20") - .setPeriod(1) - .build()); + .setPeriod("1")); SonarScanner analysis3 = SonarScanner .create(projectDir("qualitygate/small-changesets/v2-1019-lines")) .setProperty("sonar.projectKey", project.getKey()) @@ -129,14 +127,13 @@ public class OrganizationQualityGateForSmallChangesetsTest { assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", false); // big leak => use usual behaviour - tester.wsClient().qualityGates().updateCondition(UpdateConditionRequest.builder() - .setConditionId(condition.getId()) - .setMetricKey("new_coverage") - .setOperator("LT") + tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest() + .setId(String.valueOf(condition.getId())) + .setMetric("new_coverage") + .setOp("LT") .setWarning(null) .setError("70") - .setPeriod(1) - .build()); + .setPeriod("1")); SonarScanner analysis4 = SonarScanner .create(projectDir("qualitygate/small-changesets/v2-1020-lines")) .setProperty("sonar.projectKey", project.getKey()) @@ -155,7 +152,7 @@ public class OrganizationQualityGateForSmallChangesetsTest { private void assertIgnoredConditions(String projectDir, boolean expected) throws IOException { String analysisId = getAnalysisId(getTaskIdInLocalReport(projectDir(projectDir))); boolean ignoredConditions = tester.wsClient().qualityGates() - .projectStatus(new ProjectStatusWsRequest().setAnalysisId(analysisId)) + .projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId)) .getProjectStatus() .getIgnoredConditions(); assertThat(ignoredConditions).isEqualTo(expected); @@ -167,7 +164,7 @@ public class OrganizationQualityGateForSmallChangesetsTest { .call(new GetRequest("api/ce/task") .setParam("id", taskId) .setMediaType(MediaTypes.PROTOBUF)); - WsCe.TaskResponse activityWsResponse = WsCe.TaskResponse.parseFrom(activity.contentStream()); + Ce.TaskResponse activityWsResponse = Ce.TaskResponse.parseFrom(activity.contentStream()); return activityWsResponse.getTask().getAnalysisId(); } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java index be243e050bd..2deaa41a397 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java @@ -27,12 +27,12 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates.CreateWsResponse; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates.CreateWsResponse; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -49,20 +49,19 @@ public class OrganizationQualityGateTest { @Test public void always_display_current_quality_gate_in_effect() throws Exception { Organization organization = tester.organizations().generate(); - Project project = tester.projects().generate(organization); + Project project = tester.projects().provision(organization); CreateWsResponse qualityGate = tester.qGates().generate(); tester.qGates().associateProject(qualityGate, project); - tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate.getId()) - .setMetricKey("new_coverage") - .setOperator("LT") + tester.wsClient().qualityGates().createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate.getId())) + .setMetric("new_coverage") + .setOp("LT") .setWarning("90") .setError("80") - .setPeriod(1) - .build()); + .setPeriod("1")); tester.settings().setProjectSetting(project.getKey(), "sonar.leak.period", "previous_version"); String password = "password1"; - WsUsers.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password)); + Users.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password)); WsResponse response = tester.wsClient().wsConnector().call(new GetRequest("api/navigation/component").setParam("componentKey", project.getKey())); Map currentQualityGate = (Map) ItUtils.jsonToMap(response.content()).get("qualityGate"); @@ -83,14 +82,13 @@ public class OrganizationQualityGateTest { CreateWsResponse qualityGate2 = tester.qGates().generate(); tester.qGates().associateProject(qualityGate2, project); - tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate2.getId()) - .setMetricKey("new_coverage") - .setOperator("LT") + tester.wsClient().qualityGates().createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate2.getId())) + .setMetric("new_coverage") + .setOp("LT") .setWarning("90") .setError("80") - .setPeriod(1) - .build()); + .setPeriod("1")); WsResponse response3 = tester.wsClient().wsConnector().call(new GetRequest("api/navigation/component").setParam("componentKey", project.getKey())); Map currentQualityGate3 = (Map) ItUtils.jsonToMap(response3.content()).get("qualityGate"); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java index 9bb518dca20..507410d6b6b 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java @@ -31,7 +31,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage; import org.sonarqube.qa.util.pageobjects.QualityGatePage; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import util.issue.IssueRule; import static com.codeborne.selenide.Selenide.$; @@ -50,8 +50,8 @@ public class OrganizationQualityGateUiTest { public IssueRule issueRule = IssueRule.from(orchestrator); private Organizations.Organization organization; - private WsUsers.CreateWsResponse.User user; - private WsUsers.CreateWsResponse.User gateAdmin; + private Users.CreateWsResponse.User user; + private Users.CreateWsResponse.User gateAdmin; @Before public void setUp() throws Exception { @@ -98,7 +98,7 @@ public class OrganizationQualityGateUiTest { @Test public void quality_gate_link_on_project_dashboard_should_have_organization_context() { - String project = tester.projects().generate(organization).getKey(); + String project = tester.projects().provision(organization).getKey(); runProjectAnalysis(orchestrator, "shared/xoo-multi-modules-sample", "sonar.projectKey", project, "sonar.organization", organization.getKey(), diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java index d47377fd3c4..474038f74cc 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java @@ -36,7 +36,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.qa.util.pageobjects.ProjectQualityGatePage; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.qualitygate.SelectWsRequest; +import org.sonarqube.ws.client.qualitygates.SelectRequest; public class ProjectQualityGatePageTest { @@ -153,7 +153,7 @@ public class ProjectQualityGatePageTest { } private void associateWithQualityGate(QualityGate qualityGate) { - tester.wsClient().qualityGates().associateProject(new SelectWsRequest().setProjectKey("sample").setGateId(qualityGate.id())); + tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id()))); } private QualityGateClient qualityGateClient() { diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java index 84b31c58e83..e2a64b36ddf 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java @@ -29,15 +29,15 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonarqube.ws.WsMeasures.Measure; +import static org.sonarqube.ws.Measures.Measure; import static util.ItUtils.getMeasure; import static util.ItUtils.projectDir; @@ -86,10 +86,10 @@ public class QualityGateNotificationTest { .failIfNotSuccessful(); // Create quality gate with conditions on variations - WsQualityGates.CreateWsResponse simple = tester.qGates().generate(); + Qualitygates.CreateWsResponse simple = tester.qGates().generate(); tester.qGates().service() - .createCondition(CreateConditionRequest.builder().setQualityGateId(simple.getId()).setMetricKey("ncloc").setPeriod(1).setOperator("EQ").setWarning("0").build()); - Project project = tester.projects().generate(null); + .createCondition(new CreateConditionRequest().setGateId(String.valueOf(simple.getId())).setMetric("ncloc").setPeriod("1").setOp("EQ").setWarning("0")); + Project project = tester.projects().provision(); tester.qGates().associateProject(simple, project); SonarScanner analysis = SonarScanner.create(projectDir("qualitygate/xoo-sample")).setProperty("sonar.projectKey", project.getKey()); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java index da87a001fe3..5da686950bf 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java @@ -24,10 +24,10 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -46,15 +46,14 @@ public class QualityGateOnRatingMeasuresTest { @Test public void generate_warning_qgate_on_rating_metric() throws Exception { - Project project = tester.projects().generate(null); - WsQualityGates.CreateWsResponse qualityGate = tester.qGates().generate(); + Project project = tester.projects().provision(); + Qualitygates.CreateWsResponse qualityGate = tester.qGates().generate(); tester.qGates().associateProject(qualityGate, project); - tester.qGates().service().createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate.getId()) - .setMetricKey("security_rating") - .setOperator("GT") - .setWarning("3") - .build()); + tester.qGates().service().createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate.getId())) + .setMetric("security_rating") + .setOp("GT") + .setWarning("3")); ItUtils.restoreProfile(orchestrator, getClass().getResource("/qualityGate/QualityGateOnRatingMeasuresTest/with-many-rules.xml")); orchestrator.getServer().associateProjectToQualityProfile(project.getKey(), "xoo", "with-many-rules"); @@ -65,17 +64,16 @@ public class QualityGateOnRatingMeasuresTest { @Test public void generate_error_qgate_on_rating_metric_on_leak_period() throws Exception { - Project project = tester.projects().generate(null); - WsQualityGates.CreateWsResponse qualityGate = tester.qGates().generate(); + Project project = tester.projects().provision(); + Qualitygates.CreateWsResponse qualityGate = tester.qGates().generate(); tester.qGates().associateProject(qualityGate, project); tester.settings().setGlobalSetting("sonar.leak.period", "previous_version"); - tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate.getId()) - .setMetricKey("new_security_rating") - .setOperator("GT") + tester.wsClient().qualityGates().createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate.getId())) + .setMetric("new_security_rating") + .setOp("GT") .setError("3") - .setPeriod(1) - .build()); + .setPeriod("1")); // Run first analysis with empty quality gate -> quality gate is green orchestrator.getServer().associateProjectToQualityProfile(project.getKey(), "xoo", "empty"); @@ -89,7 +87,7 @@ public class QualityGateOnRatingMeasuresTest { assertThat(getGateStatusMeasure(project).getValue()).isEqualTo("ERROR"); } - private WsMeasures.Measure getGateStatusMeasure(Project project) { + private Measures.Measure getGateStatusMeasure(Project project) { return getMeasure(orchestrator, project.getKey(), "alert_status"); } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java index a88574e4866..f4c931997ed 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java @@ -44,23 +44,24 @@ import org.sonar.wsclient.qualitygate.QualityGate; import org.sonar.wsclient.qualitygate.QualityGateClient; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.TesterSession; +import org.sonarqube.ws.Ce; import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.WsCe; -import org.sonarqube.ws.WsMeasures.Measure; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates; -import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Measures.Measure; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.permission.AddUserWsRequest; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; -import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest; -import org.sonarqube.ws.client.qualitygate.QualityGatesService; -import org.sonarqube.ws.client.qualitygate.SelectWsRequest; -import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; +import org.sonarqube.ws.client.qualitygates.CreateRequest; +import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest; +import org.sonarqube.ws.client.qualitygates.QualitygatesService; +import org.sonarqube.ws.client.qualitygates.SelectRequest; +import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; @@ -246,7 +247,7 @@ public class QualityGateTest { String taskId = getTaskIdInLocalReport(projectDir("qualitygate/xoo-sample")); String analysisId = getAnalysisId(taskId); - ProjectStatusWsResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusWsRequest().setAnalysisId(analysisId)); + ProjectStatusWsResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId)); ProjectStatusWsResponse.ProjectStatus projectStatus = projectStatusWsResponse.getProjectStatus(); assertThat(projectStatus.getStatus()).isEqualTo(ProjectStatusWsResponse.Status.ERROR); assertThat(projectStatus.getConditionsCount()).isEqualTo(1); @@ -261,7 +262,7 @@ public class QualityGateTest { @Test public void does_not_fail_when_condition_is_on_removed_metric() throws Exception { // create project - Project project = tester.projects().generate(null); + Project project = tester.projects().provision(); String projectKey = project.getKey(); // create custom metric @@ -269,7 +270,7 @@ public class QualityGateTest { createCustomIntMetric(customMetricKey); try { // create quality gate - WsQualityGates.CreateWsResponse simple = tester.wsClient().qualityGates().create("OnCustomMetric"); + Qualitygates.CreateWsResponse simple = tester.wsClient().qualityGates().create(new CreateRequest().setName("OnCustomMetric")); Long qualityGateId = simple.getId(); qgClient().createCondition(NewCondition.create(qualityGateId).metricKey(customMetricKey).operator("GT").warningThreshold("40")); @@ -277,7 +278,7 @@ public class QualityGateTest { deleteCustomMetric(customMetricKey); // run analysis - tester.wsClient().qualityGates().associateProject(new SelectWsRequest().setProjectKey(projectKey).setGateId(qualityGateId)); + tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId))); BuildResult buildResult = executeAnalysis(projectKey); // verify quality gate @@ -292,16 +293,16 @@ public class QualityGateTest { public void administrate_quality_gate_with_gateadmin_permission() { // user is quality gate admin of default organization Organization organization = tester.organizations().getDefaultOrganization(); - WsUsers.CreateWsResponse.User user = tester.users().generateMember(organization); + Users.CreateWsResponse.User user = tester.users().generateMember(organization); tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); TesterSession qGateAdminTester = tester.as(user.getLogin()); - QualityGatesService qGateService = qGateAdminTester.qGates().service(); + QualitygatesService qGateService = qGateAdminTester.qGates().service(); // perform administration operations - WsQualityGates.CreateWsResponse qualityGate = qGateAdminTester.qGates().generate(); - WsQualityGates.CreateConditionWsResponse condition = qGateService.createCondition(CreateConditionRequest.builder() - .setQualityGateId(qualityGate.getId()).setMetricKey("coverage").setOperator("LT").setError("90").build()); - qGateService.updateCondition(UpdateConditionRequest.builder() - .setConditionId(condition.getId()).setMetricKey("coverage").setOperator("LT").setError("90").setWarning("80").build()); + Qualitygates.CreateWsResponse qualityGate = qGateAdminTester.qGates().generate(); + Qualitygates.CreateConditionWsResponse condition = qGateService.createCondition(new CreateConditionRequest() + .setGateId(String.valueOf(qualityGate.getId())).setMetric("coverage").setOp("LT").setError("90")); + qGateService.updateCondition(new UpdateConditionRequest() + .setId(String.valueOf(condition.getId())).setMetric("coverage").setOp("LT").setError("90").setWarning("80")); qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/set_as_default").setParam("id", qualityGate.getId())); qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/delete_condition").setParam("id", condition.getId())); qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/unset_default").setParam("id", qualityGate.getId())); @@ -330,7 +331,7 @@ public class QualityGateTest { .call(new GetRequest("api/ce/task") .setParam("id", taskId) .setMediaType(MediaTypes.PROTOBUF)); - WsCe.TaskResponse activityWsResponse = WsCe.TaskResponse.parseFrom(activity.contentStream()); + Ce.TaskResponse activityWsResponse = Ce.TaskResponse.parseFrom(activity.contentStream()); return activityWsResponse.getTask().getAnalysisId(); } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java index 9c9dc04617c..9d7a4b52765 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java @@ -34,10 +34,10 @@ import org.openqa.selenium.By; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.qa.util.pageobjects.ProjectActivityPage; -import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; -import org.sonarqube.ws.WsQualityGates; -import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; -import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest; +import org.sonarqube.ws.Projects.CreateWsResponse.Project; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; +import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest; import static com.codeborne.selenide.Selenide.$; import static org.apache.commons.lang.time.DateUtils.addDays; @@ -65,19 +65,19 @@ public class QualityGateUiTest { */ @Test public void display_alerts_correctly_in_history_page() { - Project project = tester.projects().generate(null); - WsQualityGates.CreateWsResponse qGate = tester.qGates().generate(); + Project project = tester.projects().provision(); + Qualitygates.CreateWsResponse qGate = tester.qGates().generate(); tester.qGates().associateProject(qGate, project); String firstAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -2)); String secondAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -1)); // with this configuration, project should have an Orange alert - WsQualityGates.CreateConditionWsResponse lowThresholds = tester.qGates().service() - .createCondition(CreateConditionRequest.builder().setQualityGateId(qGate.getId()).setMetricKey("lines").setOperator("GT").setWarning("5").setError("50").build()); + Qualitygates.CreateConditionWsResponse lowThresholds = tester.qGates().service() + .createCondition(new CreateConditionRequest().setGateId(String.valueOf(qGate.getId())).setMetric("lines").setOp("GT").setWarning("5").setError("50")); scanSampleWithDate(project, firstAnalysisDate); // with this configuration, project should have a Green alert - tester.qGates().service().updateCondition(UpdateConditionRequest.builder().setConditionId(lowThresholds.getId()).setMetricKey("lines").setOperator("GT").setWarning("5000").setError("5000").build()); + tester.qGates().service().updateCondition(new UpdateConditionRequest().setId(String.valueOf(lowThresholds.getId())).setMetric("lines").setOp("GT").setWarning("5000").setError("5000")); scanSampleWithDate(project, secondAnalysisDate); Navigation nav = Navigation.create(orchestrator); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/ReliabilityMeasureTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/ReliabilityMeasureTest.java index 349acb7aa46..436e13aa976 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/ReliabilityMeasureTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/ReliabilityMeasureTest.java @@ -27,7 +27,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import util.ItUtils; import static java.lang.Double.parseDouble; @@ -83,7 +83,7 @@ public class ReliabilityMeasureTest { } private void assertMeasures(String componentKey, int expectedBugs, int expectedReliabilityRemediationEffort, int expectedReliabilityRating) { - Map measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS); + Map measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS); assertThat(parseDouble(measures.get(BUGS_METRIC).getValue())).isEqualTo(expectedBugs); assertThat(parseDouble(measures.get(RELIABILITY_REMEDIATION_EFFORT_METRIC).getValue())).isEqualTo(expectedReliabilityRemediationEffort); assertThat(parseDouble(measures.get(RELIABILITY_RATING_METRIC).getValue())).isEqualTo(expectedReliabilityRating); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/SecurityMeasureTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/SecurityMeasureTest.java index f8c2d6cd367..c3feea005fd 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/SecurityMeasureTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/SecurityMeasureTest.java @@ -27,7 +27,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import util.ItUtils; import static java.lang.Double.parseDouble; @@ -83,7 +83,7 @@ public class SecurityMeasureTest { } private void assertMeasures(String componentKey, int expectedVulnerabilities, int expectedReliabilityRemediationEffort, int expectedReliabilityRating) { - Map measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS); + Map measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS); assertThat(parseDouble(measures.get(VULNERABILITIES_METRIC).getValue())).isEqualTo(expectedVulnerabilities); assertThat(parseDouble(measures.get(SECURITY_REMEDIATION_EFFORT_METRIC).getValue())).isEqualTo(expectedReliabilityRemediationEffort); assertThat(parseDouble(measures.get(SECURITY_RATING_METRIC).getValue())).isEqualTo(expectedReliabilityRating); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java index 0f71864996a..efd0562727b 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java @@ -32,7 +32,7 @@ import org.junit.rules.Timeout; import org.sonarqube.tests.Byteman; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; -import org.sonarqube.ws.QualityProfiles; +import org.sonarqube.ws.Qualityprofiles; import org.sonarqube.ws.client.rule.SearchWsRequest; import util.ItUtils; @@ -78,7 +78,7 @@ public class ActiveRuleEsResilienceTest { @Test public void activation_and_deactivation_of_rule_is_resilient_to_indexing_errors() throws Exception { Organizations.Organization organization = tester.organizations().generate(); - QualityProfiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization); + Qualityprofiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization); // step 1. activation tester.qProfiles().activateRule(profile.getKey(), RULE_ONE_BUG_PER_LINE); @@ -99,7 +99,7 @@ public class ActiveRuleEsResilienceTest { assertThat(searchActiveRules(profile)).isEqualTo(0); } - private long searchActiveRules(QualityProfiles.CreateWsResponse.QualityProfile profile) { + private long searchActiveRules(Qualityprofiles.CreateWsResponse.QualityProfile profile) { SearchWsRequest request = new SearchWsRequest().setActivation(true).setQProfile(profile.getKey()); return tester.wsClient().rules().search(request).getRulesCount(); } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java index ffd7d24bac2..3922d96b29c 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -28,7 +28,7 @@ import javax.mail.internet.MimeMessage; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddGroupWsRequest; @@ -75,7 +75,7 @@ public class BuiltInQualityProfilesNotificationTest { .build(); orchestrator.start(); userRule = UserRule.from(orchestrator); - WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate(); + Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); @@ -98,17 +98,17 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); // Create a quality profile administrator (user having direct permission) - WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate(); + Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // Create a quality profile administrator (user having permission from a group) - WsUsers.CreateWsResponse.User profileAdmin2 = userRule.generate(); + Users.CreateWsResponse.User profileAdmin2 = userRule.generate(); String groupName = randomAlphanumeric(20); wsClient.wsConnector().call(new PostRequest("api/user_groups/create").setParam("name", groupName)).failIfNotSuccessful(); wsClient.permissions().addGroup(new AddGroupWsRequest().setPermission("profileadmin").setGroupName(groupName)); wsClient.wsConnector().call(new PostRequest("api/user_groups/add_user").setParam("name", groupName).setParam("login", profileAdmin2.getLogin())).failIfNotSuccessful(); // Create a user not being quality profile administrator - WsUsers.CreateWsResponse.User noProfileAdmin = userRule.generate(); + Users.CreateWsResponse.User noProfileAdmin = userRule.generate(); // Create a child profile on the built-in profile => The notification should not take into account updates of this profile wsClient.qualityProfiles().create(CreateRequest.builder().setLanguage("foo").setName("child").build()); @@ -154,7 +154,7 @@ public class BuiltInQualityProfilesNotificationTest { .build(); orchestrator.start(); userRule = UserRule.from(orchestrator); - WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate(); + Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java index 7b255b78940..2ace14e222a 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java @@ -28,11 +28,11 @@ import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.TesterSession; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; import org.sonarqube.ws.client.qualityprofile.CopyRequest; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; @@ -112,7 +112,7 @@ public class BuiltInQualityProfilesTest { QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); TesterSession adminSession = tester.as(administrator.getLogin()); - QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); + Qualityprofiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); assertThat(copyResponse.getIsDefault()).isFalse(); assertThat(copyResponse.getKey()).isNotEmpty().isNotEqualTo(builtInProfile.getKey()); @@ -134,7 +134,7 @@ public class BuiltInQualityProfilesTest { QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); TesterSession adminSession = tester.as(administrator.getLogin()); - QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); + Qualityprofiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); adminSession.qProfiles().service().changeParent( ChangeParentRequest.builder().setParentKey(builtInProfile.getKey()).setProfileKey(copyResponse.getKey()).build()); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java index 84974475261..fe00a8d4472 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java @@ -32,9 +32,9 @@ import org.sonarqube.qa.util.QProfileTester; import org.sonarqube.qa.util.TesterSession; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; @@ -125,8 +125,8 @@ public class CustomQualityProfilesTest { QualityProfile parentProfile = adminSession.createXooProfile(org); // Copied profile - QualityProfiles.SearchWsResponse.QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); - QualityProfiles.CopyWsResponse copyResponse = adminSession.service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); + Qualityprofiles.SearchWsResponse.QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); + Qualityprofiles.CopyWsResponse copyResponse = adminSession.service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); // Inherited profile from custom QualityProfile inheritedProfile1 = adminSession.service().create( @@ -230,7 +230,7 @@ public class CustomQualityProfilesTest { adminSession.qProfiles().service().changeParent( ChangeParentRequest.builder().setParentKey(parentProfile.getKey()).setProfileKey(inheritedProfile.getKey()).build()); - QualityProfiles.SearchWsResponse.QualityProfile inheritedQualityPropfile = getProfile(org, p -> p.getKey().equals(inheritedProfile.getKey())); + Qualityprofiles.SearchWsResponse.QualityProfile inheritedQualityPropfile = getProfile(org, p -> p.getKey().equals(inheritedProfile.getKey())); assertThat(inheritedQualityPropfile.getParentKey()).isEqualTo(parentProfile.getKey()); assertThat(inheritedQualityPropfile.getParentName()).isEqualTo(parentProfile.getName()); @@ -262,7 +262,7 @@ public class CustomQualityProfilesTest { .setProjectKey(projectKey) .setProjectName(projectName)); - QualityProfiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) && + Qualityprofiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) && p.getIsDefault()); assertThatQualityProfileIsUsedFor(projectKey, defaultProfile.getKey()); @@ -318,7 +318,7 @@ public class CustomQualityProfilesTest { assertThat(((Map) ((List) components.get("qualityProfiles")).get(0)).get("key")).isEqualTo(qualityProfileKey); } - private QualityProfiles.SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { + private Qualityprofiles.SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { return tester.qProfiles().service().search(new SearchWsRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java index cf156acee16..48470073a6b 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java @@ -32,8 +32,8 @@ import org.sonarqube.qa.util.pageobjects.QualityProfilePage; import org.sonarqube.qa.util.pageobjects.RulesPage; import org.sonarqube.tests.Category6Suite; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Qualityprofiles; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; @@ -151,7 +151,7 @@ public class OrganizationQualityProfilesUiTest { @Test public void testSonarWayComparison() { - QualityProfiles.CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); + Qualityprofiles.CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); tester.qProfiles().activateRule(xooProfile, "xoo:OneBugIssuePerLine"); tester.qProfiles().activateRule(xooProfile, "xoo:OneIssuePerLine"); Navigation nav = tester.openBrowser(); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java index 142fd1d2dff..b6e884eaa77 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java @@ -28,12 +28,12 @@ import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Common; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse; -import org.sonarqube.ws.QualityProfiles.SearchUsersResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.WsUserGroups; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.UserGroups; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.permission.AddUserWsRequest; import org.sonarqube.ws.client.qualityprofile.AddGroupRequest; @@ -47,7 +47,7 @@ import org.sonarqube.ws.client.qualityprofile.ShowRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -import static org.sonarqube.ws.QualityProfiles.SearchGroupsResponse.Group; +import static org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse.Group; public class QualityProfilesEditTest { private static final String RULE_ONE_BUG_PER_LINE = "xoo:OneBugIssuePerLine"; @@ -132,9 +132,9 @@ public class QualityProfilesEditTest { @Test public void search_groups_allowed_to_edit_a_profile() { Organization organization = tester.organizations().generate(); - WsUserGroups.Group group1 = tester.groups().generate(organization); - WsUserGroups.Group group2 = tester.groups().generate(organization); - WsUserGroups.Group group3 = tester.groups().generate(organization); + UserGroups.Group group1 = tester.groups().generate(organization); + UserGroups.Group group2 = tester.groups().generate(organization); + UserGroups.Group group3 = tester.groups().generate(organization); CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); addGroupPermission(organization, group1, xooProfile); addGroupPermission(organization, group2, xooProfile); @@ -156,8 +156,8 @@ public class QualityProfilesEditTest { @Test public void add_and_remove_group() { Organization organization = tester.organizations().generate(); - WsUserGroups.Group group1 = tester.groups().generate(organization); - WsUserGroups.Group group2 = tester.groups().generate(organization); + UserGroups.Group group1 = tester.groups().generate(organization); + UserGroups.Group group2 = tester.groups().generate(organization); CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); // No group added @@ -205,7 +205,7 @@ public class QualityProfilesEditTest { CreateWsResponse.QualityProfile xooProfile1 = tester.qProfiles().createXooProfile(organization); addUserPermission(organization, user, xooProfile1); CreateWsResponse.QualityProfile xooProfile2 = tester.qProfiles().createXooProfile(organization); - WsUserGroups.Group group = tester.groups().generate(organization); + UserGroups.Group group = tester.groups().generate(organization); tester.groups().addMemberToGroups(organization, user.getLogin(), group.getName()); addGroupPermission(organization, group, xooProfile2); CreateWsResponse.QualityProfile xooProfile3 = tester.qProfiles().createXooProfile(organization); @@ -243,7 +243,7 @@ public class QualityProfilesEditTest { CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(org); User individualEditor = tester.users().generateMember(org); addUserPermission(org, individualEditor, xooProfile); - WsUserGroups.Group group = tester.groups().generate(org); + UserGroups.Group group = tester.groups().generate(org); addGroupPermission(org, group, xooProfile); User groupEditor = tester.users().generateMember(org); tester.groups().addMemberToGroups(org, groupEditor.getLogin(), group.getName()); @@ -275,7 +275,7 @@ public class QualityProfilesEditTest { .build()); } - private void addGroupPermission(Organization organization, WsUserGroups.Group group, CreateWsResponse.QualityProfile qProfile) { + private void addGroupPermission(Organization organization, UserGroups.Group group, CreateWsResponse.QualityProfile qProfile) { tester.qProfiles().service().addGroup(AddGroupRequest.builder() .setOrganization(organization.getKey()) .setQualityProfile(qProfile.getName()) diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java index 4e121520117..21b319f6f78 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java @@ -30,11 +30,11 @@ import org.skyscreamer.jsonassert.JSONCompareMode; import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse; -import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay; -import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay; +import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsResponse; diff --git a/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java b/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java index 77aca9652f4..33469fb6577 100644 --- a/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java @@ -28,8 +28,8 @@ import org.junit.Test; import org.sonarqube.tests.Category6Suite; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; -import org.sonarqube.ws.QualityProfiles.CreateWsResponse; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; import org.sonarqube.ws.Rules; import org.sonarqube.ws.client.rule.SearchWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java index 33e61642c79..e1219ae9ee6 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java @@ -29,7 +29,7 @@ import org.junit.rules.DisableOnDebug; import org.junit.rules.ExpectedException; import org.junit.rules.TestRule; import org.junit.rules.Timeout; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddUserWsRequest; @@ -75,7 +75,7 @@ public class RestartTest { createSystemAdministrator("big", "boss"); ItUtils.newUserWsClient(orchestrator, "big", "boss").system().restart(); - assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(WsSystem.Status.RESTARTING); + assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(System.Status.RESTARTING); // we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ Thread.sleep(5000); diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java index cd4e2c1ac78..ac641140873 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -77,7 +77,7 @@ public class ServerSystemRestartingOrchestrator { .build(); orchestrator.start(); - assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(WsSystem.Status.UP); + assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(System.Status.UP); } // SONAR-4748 diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemTest.java index 2e70f4e5c18..22d69666e24 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemTest.java @@ -32,7 +32,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.tests.Category4Suite; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import util.ItUtils; import util.selenium.Selenese; @@ -58,7 +58,7 @@ public class ServerSystemTest { @Test public void get_sonarqube_version() { - WsSystem.StatusResponse response = tester.wsClient().system().status(); + System.StatusResponse response = tester.wsClient().system().status(); String version = response.getVersion(); if (!startsWithAny(version, new String[]{"6.", "7.", "8."})) { diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java index 62985921e4a..5edd77875a1 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java @@ -36,7 +36,7 @@ import org.junit.rules.TemporaryFolder; import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.Elasticsearch; -import org.sonarqube.ws.WsSystem; +import org.sonarqube.ws.System; import org.sonarqube.ws.client.WsClient; import static com.google.common.base.Preconditions.checkState; @@ -64,17 +64,17 @@ public class SystemStateTest { commander.start(lock); commander.waitFor(() -> commander.webLogsContain("ServerStartupLock - Waiting for file to be deleted")); - commander.verifyStatus(WsSystem.Status.STARTING); - commander.verifyHealth(WsSystem.Health.RED, "SonarQube webserver is not up"); + commander.verifyStatus(System.Status.STARTING); + commander.verifyHealth(System.Health.RED, "SonarQube webserver is not up"); lock.unlockWeb(); // status is UP as soon as web server is up, whatever the status of Compute Engine - commander.waitFor(() -> WsSystem.Status.UP == commander.status().orElse(null)); - commander.verifyHealth(WsSystem.Health.RED, "Compute Engine is not operational"); + commander.waitFor(() -> System.Status.UP == commander.status().orElse(null)); + commander.verifyHealth(System.Health.RED, "Compute Engine is not operational"); lock.unlockCe(); - commander.waitForHealth(WsSystem.Health.GREEN); - commander.verifyStatus(WsSystem.Status.UP); + commander.waitForHealth(System.Health.GREEN); + commander.verifyStatus(System.Status.UP); } } @@ -82,16 +82,16 @@ public class SystemStateTest { public void test_status_and_health_when_ES_becomes_yellow() throws Exception { try (Commander commander = new Commander()) { commander.start(); - commander.waitForHealth(WsSystem.Health.GREEN); + commander.waitForHealth(System.Health.GREEN); commander.makeElasticsearchYellow(); - commander.waitForHealth(WsSystem.Health.YELLOW, "Elasticsearch status is YELLOW"); - commander.verifyStatus(WsSystem.Status.UP); + commander.waitForHealth(System.Health.YELLOW, "Elasticsearch status is YELLOW"); + commander.verifyStatus(System.Status.UP); commander.makeElasticsearchGreen(); - commander.waitForHealth(WsSystem.Health.GREEN); + commander.waitForHealth(System.Health.GREEN); // status does not change after being UP - commander.verifyStatus(WsSystem.Status.UP); + commander.verifyStatus(System.Status.UP); } } @@ -166,7 +166,7 @@ public class SystemStateTest { } } - Optional status() { + Optional status() { if (orchestrator.getServer() != null) { WsClient wsClient = newWsClient(orchestrator); try { @@ -178,16 +178,16 @@ public class SystemStateTest { return Optional.empty(); } - void verifyStatus(WsSystem.Status expectedStatus) { + void verifyStatus(System.Status expectedStatus) { assertThat(status()).hasValue(expectedStatus); } - Optional health() { - Optional response = healthResponse(); - return response.map(WsSystem.HealthResponse::getHealth); + Optional health() { + Optional response = healthResponse(); + return response.map(System.HealthResponse::getHealth); } - Optional healthResponse() { + Optional healthResponse() { if (orchestrator.getServer() != null) { WsClient wsClient = newSystemUserWsClient(orchestrator, systemPassCode); try { @@ -199,18 +199,18 @@ public class SystemStateTest { return Optional.empty(); } - void waitForHealth(WsSystem.Health expectedHealth, String... expectedMessages) { + void waitForHealth(System.Health expectedHealth, String... expectedMessages) { waitFor(() -> expectedHealth == health().orElse(null)); verifyHealth(expectedHealth, expectedMessages); } - void verifyHealth(WsSystem.Health expectedHealth, String... expectedMessages) { - WsSystem.HealthResponse response = healthResponse().get(); + void verifyHealth(System.Health expectedHealth, String... expectedMessages) { + System.HealthResponse response = healthResponse().get(); assertThat(response.getHealth()) .describedAs("Expected status %s in response %s", expectedHealth, response) .isEqualTo(expectedHealth); assertThat(response.getCausesList()) - .extracting(WsSystem.Cause::getMessage) + .extracting(System.Cause::getMessage) .describedAs("Expected causes %s in response %s", Arrays.asList(expectedMessages), response) .containsExactlyInAnyOrder(expectedMessages); } diff --git a/tests/src/test/java/org/sonarqube/tests/settings/DeprecatedPropertiesWsTest.java b/tests/src/test/java/org/sonarqube/tests/settings/DeprecatedPropertiesWsTest.java index 4a0bd037333..0448d8bac88 100644 --- a/tests/src/test/java/org/sonarqube/tests/settings/DeprecatedPropertiesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/settings/DeprecatedPropertiesWsTest.java @@ -22,6 +22,7 @@ package org.sonarqube.tests.settings; import com.google.common.base.Throwables; import com.google.gson.Gson; import com.sonar.orchestrator.Orchestrator; +import org.junit.rules.RuleChain; import org.sonarqube.tests.Category1Suite; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -69,8 +70,10 @@ public class DeprecatedPropertiesWsTest { @ClassRule public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; + private static UserRule userRule = UserRule.from(orchestrator); + @ClassRule - public static UserRule userRule = UserRule.from(orchestrator); + public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule); static WsClient adminWsClient; static WsClient userWsClient; diff --git a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java index de7d213db2b..df5b3fe02d7 100644 --- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java @@ -21,6 +21,7 @@ package org.sonarqube.tests.settings; import com.google.common.collect.ImmutableMap; import com.sonar.orchestrator.Orchestrator; +import org.junit.rules.RuleChain; import org.sonarqube.tests.Category1Suite; import java.io.IOException; import java.util.List; @@ -62,8 +63,10 @@ public class SettingsTest { @ClassRule public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; + private static UserRule userRule = UserRule.from(orchestrator); + @ClassRule - public static UserRule userRule = UserRule.from(orchestrator); + public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule); private static WsClient adminWsClient; private static SettingsService anonymousSettingsService; diff --git a/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java b/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java index 1e95f664ec3..8032a439d3b 100644 --- a/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java @@ -35,7 +35,7 @@ import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.qa.util.LogsTailer; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.user.SearchRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -65,7 +65,7 @@ public class StartupIndexationTest { sonarQube.resume(); sonarQubeIsUpWatcher.waitForLog(20, TimeUnit.SECONDS); SearchRequest searchRequest = SearchRequest.builder().setQuery("admin").build(); - WsUsers.SearchWsResponse searchWsResponse = sonarQube.tester.wsClient().users().search(searchRequest); + Users.SearchWsResponse searchWsResponse = sonarQube.tester.wsClient().users().search(searchRequest); assertThat(searchWsResponse.getUsersCount()).isEqualTo(1); assertThat(searchWsResponse.getUsers(0).getName()).isEqualTo("Administrator"); } diff --git a/tests/src/test/java/org/sonarqube/tests/test/NewCoverageTest.java b/tests/src/test/java/org/sonarqube/tests/test/NewCoverageTest.java index 670d5440479..3c77acc0581 100644 --- a/tests/src/test/java/org/sonarqube/tests/test/NewCoverageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/test/NewCoverageTest.java @@ -27,7 +27,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsMeasures; +import org.sonarqube.ws.Measures; import static java.lang.Double.parseDouble; import static org.assertj.core.api.Assertions.assertThat; @@ -54,7 +54,7 @@ public class NewCoverageTest { orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v2")) .setProperty("sonar.scm.disabled", "false")); - Map measures = getMeasuresWithVariationsByMetricKey(orchestrator, PROJECT_KEY, ALL_NEW_COVERAGE_METRICS); + Map measures = getMeasuresWithVariationsByMetricKey(orchestrator, PROJECT_KEY, ALL_NEW_COVERAGE_METRICS); assertThat(parseDouble(measures.get("new_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(66.6d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_line_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(100d, DEFAULT_OFFSET); assertThat(parseDouble(measures.get("new_branch_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(42.8, DEFAULT_OFFSET); diff --git a/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java b/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java index 4a8bbfe31da..8e6f6cba821 100644 --- a/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java @@ -26,8 +26,8 @@ import org.junit.Rule; import org.junit.Test; import org.openqa.selenium.By; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsProjects; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.project.CreateRequest; import util.ItUtils; import util.selenium.Selenese; @@ -78,7 +78,7 @@ public class UiExtensionsTest { @Test public void test_project_page() { - WsProjects.CreateWsResponse.Project project = createSampleProject(); + Projects.CreateWsResponse.Project project = createSampleProject(); tester.openBrowser().open("/dashboard?id=" + project.getKey()); @@ -91,7 +91,7 @@ public class UiExtensionsTest { @Test public void test_project_administration_page() { - WsProjects.CreateWsResponse.Project project = createSampleProject(); + Projects.CreateWsResponse.Project project = createSampleProject(); User administrator = tester.users().generateAdministrator(); tester.openBrowser() @@ -105,7 +105,7 @@ public class UiExtensionsTest { $("body").shouldHave(text("uiextensionsplugin/project_admin_page")); } - private WsProjects.CreateWsResponse.Project createSampleProject() { + private Projects.CreateWsResponse.Project createSampleProject() { String projectKey = ItUtils.newProjectKey(); return tester.wsClient().projects().create(CreateRequest.builder() .setKey(projectKey) diff --git a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java index d7562caa960..76f2e28431c 100644 --- a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java +++ b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java @@ -36,7 +36,7 @@ import org.apache.commons.io.IOUtils; import org.junit.After; import org.junit.Test; import org.sonarqube.qa.util.SelenideConfig; -import org.sonarqube.ws.WsMeasures.Measure; +import org.sonarqube.ws.Measures.Measure; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; diff --git a/tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java index bcd7384dfae..db5b754b000 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java @@ -20,15 +20,16 @@ package org.sonarqube.tests.user; import com.google.common.base.Joiner; -import com.google.common.base.Optional; import com.sonar.orchestrator.Orchestrator; import java.io.File; +import java.util.Optional; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.junit.rules.RuleChain; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.tests.Category4Suite; import org.sonarqube.ws.client.GetRequest; @@ -38,7 +39,6 @@ import util.user.UserRule; import util.user.Users; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static util.ItUtils.newAdminWsClient; import static util.ItUtils.resetSettings; import static util.ItUtils.setServerProperty; @@ -53,8 +53,10 @@ public class BaseIdentityProviderTest { @ClassRule public static Orchestrator ORCHESTRATOR = Category4Suite.ORCHESTRATOR; + private static UserRule userRule = UserRule.from(ORCHESTRATOR); + @ClassRule - public static UserRule userRule = UserRule.from(ORCHESTRATOR); + public static RuleChain ruleChain = RuleChain.outerRule(ORCHESTRATOR).around(userRule); static String FAKE_PROVIDER_KEY = "fake-base-id-provider"; diff --git a/tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java index d09aa110288..eb5fdfb4635 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java @@ -27,7 +27,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; diff --git a/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java index 30203f58e6a..14b8237feab 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java @@ -30,9 +30,9 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.LoginPage; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.tests.Category4Suite; -import org.sonarqube.ws.WsUserTokens; -import org.sonarqube.ws.WsUsers; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.UserTokens; +import org.sonarqube.ws.Users; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.PostRequest; @@ -106,7 +106,7 @@ public class LocalAuthenticationTest { User user = tester.users().generate(); String tokenName = "Validate token based authentication"; UserTokensService tokensService = tester.wsClient().userTokens(); - WsUserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest() + UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest() .setLogin(user.getLogin()) .setName(tokenName)); WsClient wsClient = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder() @@ -117,7 +117,7 @@ public class LocalAuthenticationTest { assertThat(response.content()).isEqualTo("{\"valid\":true}"); - WsUserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin())); + UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin())); assertThat(searchResponse.getUserTokensCount()).isEqualTo(1); tokensService.revoke(new RevokeWsRequest().setLogin(user.getLogin()).setName(tokenName)); searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin())); @@ -247,8 +247,8 @@ public class LocalAuthenticationTest { assertThat(checkAuthenticationWithAuthenticateWebService("test", "password")).isTrue(); assertThat(tester.users().getByLogin("test").get()) - .extracting(WsUsers.SearchWsResponse.User::getLogin, WsUsers.SearchWsResponse.User::getName, WsUsers.SearchWsResponse.User::getEmail, u -> u.getScmAccounts().getScmAccountsList(), - WsUsers.SearchWsResponse.User::getExternalIdentity, WsUsers.SearchWsResponse.User::getExternalProvider) + .extracting(Users.SearchWsResponse.User::getLogin, Users.SearchWsResponse.User::getName, Users.SearchWsResponse.User::getEmail, u -> u.getScmAccounts().getScmAccountsList(), + Users.SearchWsResponse.User::getExternalIdentity, Users.SearchWsResponse.User::getExternalProvider) .containsOnly("test", "Test", "test@email.com", asList("test1", "test2"), "test", "sonarqube"); } diff --git a/tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java b/tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java index ec0961811d3..c4b2739585b 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.tests.Category4Suite; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; import static com.codeborne.selenide.Condition.text; diff --git a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java index 740fd28835c..2f6e7f36f1b 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java @@ -35,7 +35,7 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; import org.sonarqube.tests.Category4Suite; -import org.sonarqube.ws.WsUsers.SearchWsResponse.User; +import org.sonarqube.ws.Users.SearchWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.permission.AddUserWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java b/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java index f0f9c614629..b3638e6019b 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java @@ -20,19 +20,15 @@ package org.sonarqube.tests.user; import com.sonar.orchestrator.Orchestrator; -import org.junit.After; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.WsClient; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; -import static util.ItUtils.resetSettings; -import static util.ItUtils.setServerProperty; public class OnboardingTest { @@ -44,16 +40,6 @@ public class OnboardingTest { @Rule public Tester tester = new Tester(orchestrator).disableOrganizations(); - @Before - public void setUp() { - resetSettings(orchestrator, null, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS); - } - - @After - public void reset() { - resetSettings(orchestrator, null, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS); - } - @Test public void by_default_new_user_does_not_see_onboarding_tutorial() { User user = tester.users().generate(); @@ -145,8 +131,8 @@ public class OnboardingTest { verifyTutorial(reactivatedUser, true); } - private static void setShownOnboardingSetting(boolean showTutorial) { - setServerProperty(orchestrator, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS, String.valueOf(showTutorial)); + private void setShownOnboardingSetting(boolean showTutorial) { + tester.settings().setGlobalSettings(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS, String.valueOf(showTutorial)); } private void verifyTutorial(User user, boolean expectedTutorial) { diff --git a/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java index 22e1dee4984..d3edfa5b92a 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java @@ -21,20 +21,17 @@ package org.sonarqube.tests.user; import com.google.common.base.Joiner; import com.sonar.orchestrator.Orchestrator; -import org.sonarqube.tests.Category6Suite; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUserGroups.Group; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.tests.Category6Suite; +import org.sonarqube.ws.UserGroups.Group; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.GetRequest; -import static util.ItUtils.resetSettings; -import static util.ItUtils.setServerProperty; - public class OrganizationIdentityProviderTest { @ClassRule @@ -43,22 +40,21 @@ public class OrganizationIdentityProviderTest { @Rule public Tester tester = new Tester(orchestrator); - @Before public void setUp() { // enable the fake authentication plugin - setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.enabled", "true"); + tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.enabled", "true"); } @After public void tearDown() { - resetSettings(orchestrator, null, "sonar.auth.fake-base-id-provider.enabled", "sonar.auth.fake-base-id-provider.user", + tester.settings().resetSettings("sonar.auth.fake-base-id-provider.enabled", "sonar.auth.fake-base-id-provider.user", "sonar.auth.fake-base-id-provider.throwUnauthorizedMessage", "sonar.auth.fake-base-id-provider.enabledGroupsSync", "sonar.auth.fake-base-id-provider.groups", "sonar.auth.fake-base-id-provider.allowsUsersToSignUp"); } @Test - public void default_group_is_not_added_for_new_user_when_organizations_are_enabled() { + public void default_group_is_not_added_for_new_user_when_organizations_are_enabled() { Group group = tester.groups().generate(null); enableUserCreationByAuthPlugin("aLogin"); setGroupsReturnedByAuthPlugin(group.getName()); @@ -99,14 +95,14 @@ public class OrganizationIdentityProviderTest { tester.groups().assertThatUserIsOnlyMemberOf(null, user.getLogin()); } - private static void enableUserCreationByAuthPlugin(String login) { - setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.user", login + ",fake-john,John,john@email.com"); + private void enableUserCreationByAuthPlugin(String login) { + tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.user", login + ",fake-john,John,john@email.com"); } - private static void setGroupsReturnedByAuthPlugin(String... groups) { - setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.enabledGroupsSync", "true"); + private void setGroupsReturnedByAuthPlugin(String... groups) { + tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.enabledGroupsSync", "true"); if (groups.length > 0) { - setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.groups", Joiner.on(",").join(groups)); + tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.groups", Joiner.on(",").join(groups)); } } diff --git a/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java index aee0917c8f8..686732cb340 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java @@ -36,8 +36,8 @@ import org.sonar.wsclient.base.HttpException; import org.sonar.wsclient.connectors.HttpClient4Connector; import org.sonar.wsclient.services.AuthenticationQuery; import org.sonar.wsclient.user.UserParameters; -import org.sonarqube.qa.util.pageobjects.SystemInfoPage; import org.sonarqube.qa.util.Tester; +import org.sonarqube.qa.util.pageobjects.SystemInfoPage; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.user.CreateRequest; @@ -48,11 +48,9 @@ import static java.net.HttpURLConnection.HTTP_OK; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; -import static util.ItUtils.newAdminWsClient; import static util.ItUtils.newUserWsClient; import static util.ItUtils.pluginArtifact; import static util.ItUtils.resetSettings; -import static util.ItUtils.setServerProperty; import static util.selenium.Selenese.runSelenese; /** @@ -293,7 +291,7 @@ public class RealmAuthenticationTest { verifyAuthenticationIsNotOk(login, null); verifyAuthenticationIsOk(null, null); - setServerProperty(orchestrator, "sonar.forceAuthentication", "true"); + tester.settings().setGlobalSettings("sonar.forceAuthentication", "true"); verifyAuthenticationIsOk(login, password); verifyAuthenticationIsNotOk("wrong", password); @@ -313,7 +311,7 @@ public class RealmAuthenticationTest { @Test public void provision_user_before_authentication() { - newAdminWsClient(orchestrator).users().create(CreateRequest.builder() + tester.wsClient().users().create(CreateRequest.builder() .setLogin(USER_LOGIN) .setName("Tester Testerovich") .setEmail("tester@example.org") @@ -346,8 +344,8 @@ public class RealmAuthenticationTest { /** * Updates information about users in security-plugin. */ - private static void updateUsersInExtAuth(Map users) { - setServerProperty(orchestrator, USERS_PROPERTY, format(users)); + private void updateUsersInExtAuth(Map users) { + tester.settings().setGlobalSettings(USERS_PROPERTY, format(users)); } private void createUserInDb(String login, String password) { diff --git a/tests/src/test/java/org/sonarqube/tests/user/SsoAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/SsoAuthenticationTest.java index 2860b09dfb7..07214b2a5bc 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/SsoAuthenticationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/SsoAuthenticationTest.java @@ -28,6 +28,7 @@ import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.junit.rules.RuleChain; import util.user.UserRule; import static java.nio.charset.StandardCharsets.UTF_8; @@ -63,61 +64,63 @@ public class SsoAuthenticationTest { .setServerProperty("sonar.web.sso.groupsHeader", GROUPS_HEADER) .build(); + private static UserRule userRule = UserRule.from(orchestrator); + @ClassRule - public static UserRule USER_RULE = UserRule.from(orchestrator); + public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule); @Before public void resetData() throws Exception { - USER_RULE.resetUsers(); + userRule.resetUsers(); } @Test public void authenticate() { doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null); - USER_RULE.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL); + userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL); } @Test public void authenticate_with_only_login() throws Exception { doCall(USER_LOGIN, null, null, null); - USER_RULE.verifyUserExists(USER_LOGIN, USER_LOGIN, null); + userRule.verifyUserExists(USER_LOGIN, USER_LOGIN, null); } @Test public void update_user_when_headers_are_updated() { doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null); - USER_RULE.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL); + userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL); // As we don't keep the JWT token is the test, the user is updated doCall(USER_LOGIN, "new name", "new email", null); - USER_RULE.verifyUserExists(USER_LOGIN, "new name", "new email"); + userRule.verifyUserExists(USER_LOGIN, "new name", "new email"); } @Test public void authenticate_with_groups() { doCall(USER_LOGIN, null, null, GROUP_1); - USER_RULE.verifyUserGroupMembership(USER_LOGIN, GROUP_1, "sonar-users"); + userRule.verifyUserGroupMembership(USER_LOGIN, GROUP_1, "sonar-users"); } @Test public void synchronize_groups_when_authenticating_existing_user() throws Exception { - USER_RULE.createGroup(GROUP_1); - USER_RULE.createGroup(GROUP_2); - USER_RULE.createGroup(GROUP_3); - USER_RULE.createUser(USER_LOGIN, "password"); - USER_RULE.associateGroupsToUser(USER_LOGIN, GROUP_1, GROUP_2); + userRule.createGroup(GROUP_1); + userRule.createGroup(GROUP_2); + userRule.createGroup(GROUP_3); + userRule.createUser(USER_LOGIN, "password"); + userRule.associateGroupsToUser(USER_LOGIN, GROUP_1, GROUP_2); doCall(USER_LOGIN, null, null, GROUP_2 + "," + GROUP_3); - USER_RULE.verifyUserGroupMembership(USER_LOGIN, GROUP_2, GROUP_3, "sonar-users"); + userRule.verifyUserGroupMembership(USER_LOGIN, GROUP_2, GROUP_3, "sonar-users"); } @Test public void authentication_with_local_user_is_possible_when_no_header() throws Exception { - USER_RULE.createUser(USER_LOGIN, "password"); + userRule.createUser(USER_LOGIN, "password"); checkLocalAuthentication(USER_LOGIN, "password"); } @@ -131,12 +134,12 @@ public class SsoAuthenticationTest { List logsLines = FileUtils.readLines(orchestrator.getServer().getWebLogs(), UTF_8); assertThat(logsLines).doesNotContain("org.sonar.server.exceptions.BadRequestException: Use only letters, numbers, and .-_@ please."); - USER_RULE.verifyUserDoesNotExist(USER_LOGIN); + userRule.verifyUserDoesNotExist(USER_LOGIN); } @Test public void fail_when_email_already_exists() throws Exception { - USER_RULE.createUser("another", "Another", USER_EMAIL, "another"); + userRule.createUser("another", "Another", USER_EMAIL, "another"); Response response = doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null); diff --git a/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java index 7aa50328352..f73b1fab03d 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java @@ -31,7 +31,7 @@ import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonarqube.tests.Byteman; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers.CreateWsResponse.User; +import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.user.SearchRequest; import org.sonarqube.ws.client.user.UpdateRequest; import util.ItUtils; diff --git a/tests/src/test/java/org/sonarqube/tests/user/UsersPageTest.java b/tests/src/test/java/org/sonarqube/tests/user/UsersPageTest.java index b983b0e69e0..38b62681a9c 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/UsersPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/UsersPageTest.java @@ -27,7 +27,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.user.GroupsRequest; import util.selenium.Selenese; @@ -77,8 +77,8 @@ public class UsersPageTest { userRule.createGroup(group); userRule.associateGroupsToUser(login, group); - List result = adminClient.users().groups(GroupsRequest.builder().setLogin(login).build()).getGroupsList(); + List result = adminClient.users().groups(GroupsRequest.builder().setLogin(login).build()).getGroupsList(); - assertThat(result).extracting(WsUsers.GroupsWsResponse.Group::getName).contains(group); + assertThat(result).extracting(Users.GroupsWsResponse.Group::getName).contains(group); } } diff --git a/tests/src/test/java/util/ItUtils.java b/tests/src/test/java/util/ItUtils.java index b10257c2c53..f663c7d6b94 100644 --- a/tests/src/test/java/util/ItUtils.java +++ b/tests/src/test/java/util/ItUtils.java @@ -63,9 +63,9 @@ import org.sonar.wsclient.issue.IssueClient; import org.sonar.wsclient.issue.IssueQuery; import org.sonarqube.qa.util.SettingTester; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsComponents.Component; -import org.sonarqube.ws.WsMeasures; -import org.sonarqube.ws.WsMeasures.Measure; +import org.sonarqube.ws.Components.Component; +import org.sonarqube.ws.Measures; +import org.sonarqube.ws.Measures.Measure; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; @@ -343,7 +343,7 @@ public class ItUtils { @CheckForNull public static Measure getMeasureWithVariation(Orchestrator orchestrator, String componentKey, String metricKey) { - WsMeasures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentWsRequest() + Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentWsRequest() .setComponentKey(componentKey) .setMetricKeys(singletonList(metricKey)) .setAdditionalFields(singletonList("periods"))); @@ -366,7 +366,7 @@ public class ItUtils { */ @CheckForNull public static Double getLeakPeriodValue(Orchestrator orchestrator, String componentKey, String metricKey) { - List periodsValueList = getMeasureWithVariation(orchestrator, componentKey, metricKey).getPeriods().getPeriodsValueList(); + List periodsValueList = getMeasureWithVariation(orchestrator, componentKey, metricKey).getPeriods().getPeriodsValueList(); return periodsValueList.size() > 0 ? Double.parseDouble(periodsValueList.get(0).getValue()) : null; } diff --git a/tests/src/test/java/util/user/UserRule.java b/tests/src/test/java/util/user/UserRule.java index beb07e114d2..80df9438ab6 100644 --- a/tests/src/test/java/util/user/UserRule.java +++ b/tests/src/test/java/util/user/UserRule.java @@ -19,19 +19,18 @@ */ package util.user; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.FluentIterable; import com.sonar.orchestrator.Orchestrator; import java.util.List; +import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Predicate; import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.junit.rules.ExternalResource; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.WsUsers; +import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; @@ -47,7 +46,6 @@ import static java.util.Arrays.stream; import static java.util.Objects.requireNonNull; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static util.ItUtils.newAdminWsClient; /** @@ -83,7 +81,7 @@ public class UserRule extends ExternalResource implements GroupManagement { // ***************** public void resetUsers() { - for (Users.User user : getUsers().getUsers()) { + for (util.user.Users.User user : getUsers().getUsers()) { String userLogin = user.getLogin(); if (!userLogin.equals(ADMIN_LOGIN)) { deactivateUsers(userLogin); @@ -91,8 +89,8 @@ public class UserRule extends ExternalResource implements GroupManagement { } } - public Users.User verifyUserExists(String login, String name, @Nullable String email) { - Optional user = getUserByLogin(login); + public util.user.Users.User verifyUserExists(String login, String name, @Nullable String email) { + Optional user = getUserByLogin(login); assertThat(user).as("User with login '%s' hasn't been found", login).isPresent(); assertThat(user.get().getLogin()).isEqualTo(login); assertThat(user.get().getName()).isEqualTo(name); @@ -101,15 +99,15 @@ public class UserRule extends ExternalResource implements GroupManagement { } public void verifyUserExists(String login, String name, @Nullable String email, boolean local) { - Users.User user = verifyUserExists(login, name, email); + util.user.Users.User user = verifyUserExists(login, name, email); assertThat(user.isLocal()).isEqualTo(local); } public void verifyUserDoesNotExist(String login) { - assertThat(getUserByLogin(login)).as("Unexpected user with login '%s' has been found", login).isAbsent(); + assertThat(getUserByLogin(login)).as("Unexpected user with login '%s' has been found", login).isEmpty(); } - public WsUsers.CreateWsResponse.User createUser(String login, String name, @Nullable String email, String password) { + public Users.CreateWsResponse.User createUser(String login, String name, @Nullable String email, String password) { CreateRequest.Builder request = CreateRequest.builder() .setLogin(login) .setName(name) @@ -122,7 +120,7 @@ public class UserRule extends ExternalResource implements GroupManagement { * Create user with randomly generated values. By default password is the login. */ @SafeVarargs - public final WsUsers.CreateWsResponse.User generate(Consumer... populators) { + public final org.sonarqube.ws.Users.CreateWsResponse.User generate(Consumer... populators) { int id = ID_GENERATOR.getAndIncrement(); String login = "login" + id; CreateRequest.Builder request = CreateRequest.builder() @@ -157,15 +155,15 @@ public class UserRule extends ExternalResource implements GroupManagement { adminWsClient().roots().setRoot(login); } - public Optional getUserByLogin(String login) { - return FluentIterable.from(getUsers().getUsers()).firstMatch(new MatchUserLogin(login)); + public Optional getUserByLogin(String login) { + return getUsers().getUsers().stream().filter(new MatchUserLogin(login)).findFirst(); } - public Users getUsers() { + public util.user.Users getUsers() { WsResponse response = adminWsClient().wsConnector().call( new GetRequest("api/users/search")) .failIfNotSuccessful(); - return Users.parse(response.content()); + return util.user.Users.parse(response.content()); } public void deactivateUsers(List userLogins) { @@ -194,10 +192,6 @@ public class UserRule extends ExternalResource implements GroupManagement { // User groups // ***************** - public GroupManagement forOrganization(String organizationKey) { - return new GroupManagementImpl(organizationKey); - } - private final class GroupManagementImpl implements GroupManagement { @CheckForNull private final String organizationKey; @@ -247,7 +241,7 @@ public class UserRule extends ExternalResource implements GroupManagement { @Override public java.util.Optional getGroupByName(String name) { - return getGroups().getGroups().stream().filter(new MatchGroupName(name)::apply).findFirst(); + return getGroups().getGroups().stream().filter(new MatchGroupName(name)).findFirst(); } @Override @@ -339,7 +333,7 @@ public class UserRule extends ExternalResource implements GroupManagement { return adminWsClient; } - private class MatchUserLogin implements Predicate { + private class MatchUserLogin implements Predicate { private final String login; private MatchUserLogin(String login) { @@ -347,7 +341,7 @@ public class UserRule extends ExternalResource implements GroupManagement { } @Override - public boolean apply(@Nonnull Users.User user) { + public boolean test(@Nonnull util.user.Users.User user) { String login = user.getLogin(); return login != null && login.equals(this.login) && user.isActive(); } @@ -361,7 +355,7 @@ public class UserRule extends ExternalResource implements GroupManagement { } @Override - public boolean apply(@Nonnull Groups.Group group) { + public boolean test(@Nonnull Groups.Group group) { String groupName = group.getName(); return groupName != null && groupName.equals(this.groupName); } diff --git a/tests/src/test/java/util/user/Users.java b/tests/src/test/java/util/user/Users.java index 2f0a252e6c7..01e3c70238d 100644 --- a/tests/src/test/java/util/user/Users.java +++ b/tests/src/test/java/util/user/Users.java @@ -22,6 +22,7 @@ package util.user; import com.google.gson.Gson; import java.util.List; +@Deprecated public class Users { private List users;