From: Daniel Schwarz Date: Sat, 25 Nov 2017 06:21:02 +0000 (+0100) Subject: Apply naming conventions in sonar-ws protobuf X-Git-Tag: 7.0-RC1~254 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b4a1564642ca0fc1528f2bf4b638c57860649775;p=sonarqube.git Apply naming conventions in sonar-ws protobuf --- 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 08c317c6d40..f38dbde22e8 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 @@ -28,10 +28,10 @@ import org.sonarqube.ws.Organizations; import org.sonarqube.ws.Users; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.organization.CreateWsRequest; +import org.sonarqube.ws.client.organization.CreateRequest; import org.sonarqube.ws.client.organization.OrganizationService; -import org.sonarqube.ws.client.organization.SearchMembersWsRequest; -import org.sonarqube.ws.client.organization.SearchWsRequest; +import org.sonarqube.ws.client.organization.SearchMembersRequest; +import org.sonarqube.ws.client.organization.SearchRequest; import org.sonarqube.ws.client.user.GroupsRequest; import static java.util.Arrays.stream; @@ -51,16 +51,16 @@ public class OrganizationTester { } void deleteNonGuardedOrganizations() { - service().search(SearchWsRequest.builder().build()).getOrganizationsList() + service().search(SearchRequest.builder().build()).getOrganizationsList() .stream() .filter(o -> !o.getKey().equals("default-organization")) .forEach(organization -> service().delete(organization.getKey())); } @SafeVarargs - public final Organizations.Organization generate(Consumer... populators) { + public final Organizations.Organization generate(Consumer... populators) { int id = ID_GENERATOR.getAndIncrement(); - CreateWsRequest.Builder request = new CreateWsRequest.Builder() + CreateRequest.Builder request = new CreateRequest.Builder() .setKey("org" + id) .setName("Org " + id) .setDescription("Description " + id) @@ -75,14 +75,14 @@ public class OrganizationTester { } public Organizations.Organization getDefaultOrganization() { - return service().search(SearchWsRequest.builder().build()).getOrganizationsList() + return service().search(SearchRequest.builder().build()).getOrganizationsList() .stream() .filter(o -> o.getKey().equals("default-organization")) .findFirst().orElseThrow(() -> new IllegalStateException("Can't find default organization")); } public OrganizationTester assertThatOrganizationDoesNotExist(String organizationKey) { - SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(organizationKey).build(); + SearchRequest request = new SearchRequest.Builder().setOrganizations(organizationKey).build(); Organizations.SearchWsResponse searchWsResponse = service().search(request); Assertions.assertThat(searchWsResponse.getOrganizationsList()).isEmpty(); return this; @@ -116,7 +116,7 @@ public class OrganizationTester { } private void verifyOrganizationMembership(@Nullable Organizations.Organization organization, String userLogin, boolean isMember) { - List users = service().searchMembers(new SearchMembersWsRequest() + List users = service().searchMembers(new SearchMembersRequest() .setQuery(userLogin) .setSelected("selected") .setOrganization(organization != null ? organization.getKey() : null)) 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 9c48acaf47b..00eaf34ca73 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 @@ -27,7 +27,7 @@ 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; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import static java.util.Arrays.stream; import static java.util.Collections.singletonList; @@ -44,7 +44,7 @@ public class ProjectTester { void deleteAll() { ProjectsService service = session.wsClient().projects(); - service.search(SearchWsRequest.builder().setQualifiers(singletonList("TRK")).build()).getComponentsList().forEach(p -> + service.search(SearchRequest.builder().setQualifiers(singletonList("TRK")).build()).getComponentsList().forEach(p -> service.delete(DeleteRequest.builder().setKey(p.getKey()).build())); } 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 102581d155d..38e81ca6769 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 @@ -29,7 +29,7 @@ import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile; import org.sonarqube.ws.Rules; 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.ActivateRuleRequest; import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; @@ -69,7 +69,7 @@ public class QProfileTester { } public QProfileTester activateRule(String profileKey, String ruleKey) { - ActivateRuleWsRequest request = ActivateRuleWsRequest.builder() + ActivateRuleRequest request = ActivateRuleRequest.builder() .setKey(profileKey) .setRuleKey(ruleKey) .build(); 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 d5546e5761a..9445767c8f1 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 @@ -74,7 +74,7 @@ public class UserTester { @SafeVarargs public final User generateAdministrator(Consumer... populators) { User user = generate(populators); - session.wsClient().permissions().addUser(new org.sonarqube.ws.client.permission.AddUserWsRequest().setLogin(user.getLogin()).setPermission("admin")); + session.wsClient().permissions().addUser(new org.sonarqube.ws.client.permission.AddUserRequest().setLogin(user.getLogin()).setPermission("admin")); session.wsClient().userGroups().addUser(new AddUserRequest().setLogin(user.getLogin()).setName("sonar-administrators")); return user; } 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 8e847517bc8..2307faf3e85 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 @@ -43,7 +43,7 @@ import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.ws.WsUtils; import org.sonarqube.ws.Components; import org.sonarqube.ws.Components.SearchWsResponse; -import org.sonarqube.ws.client.component.SearchWsRequest; +import org.sonarqube.ws.client.component.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; import static java.util.stream.Collectors.toMap; @@ -116,8 +116,8 @@ public class SearchAction implements ComponentsWsAction { writeProtobuf(searchWsResponse, wsRequest, wsResponse); } - private static SearchWsRequest toSearchWsRequest(Request request) { - return new SearchWsRequest() + private static SearchRequest toSearchWsRequest(Request request) { + return new SearchRequest() .setOrganization(request.param(PARAM_ORGANIZATION)) .setQualifiers(request.mandatoryParamAsStrings(PARAM_QUALIFIERS)) .setLanguage(request.param(PARAM_LANGUAGE)) @@ -126,7 +126,7 @@ public class SearchAction implements ComponentsWsAction { .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)); } - private SearchWsResponse doHandle(SearchWsRequest request) { + private SearchWsResponse doHandle(SearchRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = getOrganization(dbSession, request); ComponentQuery esQuery = buildEsQuery(organization, request); @@ -148,7 +148,7 @@ public class SearchAction implements ComponentsWsAction { return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::getDbKey)); } - private OrganizationDto getOrganization(DbSession dbSession, SearchWsRequest request) { + private OrganizationDto getOrganization(DbSession dbSession, SearchRequest request) { String organizationKey = Optional.ofNullable(request.getOrganization()) .orElseGet(defaultOrganizationProvider.get()::getKey); return WsUtils.checkFoundWithOptional( @@ -156,7 +156,7 @@ public class SearchAction implements ComponentsWsAction { "No organizationDto with key '%s'", organizationKey); } - private static ComponentQuery buildEsQuery(OrganizationDto organization, SearchWsRequest request) { + private static ComponentQuery buildEsQuery(OrganizationDto organization, SearchRequest request) { return ComponentQuery.builder() .setQuery(request.getQuery()) .setOrganization(organization.getUuid()) 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 8288af7cec1..3799794e012 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 @@ -35,7 +35,7 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Components.ShowWsResponse; -import org.sonarqube.ws.client.component.ShowWsRequest; +import org.sonarqube.ws.client.component.ShowRequest; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -100,13 +100,13 @@ public class ShowAction implements ComponentsWsAction { @Override public void handle(Request request, Response response) throws Exception { - ShowWsRequest showWsRequest = toShowWsRequest(request); - ShowWsResponse showWsResponse = doHandle(showWsRequest); + ShowRequest showRequest = toShowWsRequest(request); + ShowWsResponse showWsResponse = doHandle(showRequest); writeProtobuf(showWsResponse, request, response); } - private ShowWsResponse doHandle(ShowWsRequest request) { + private ShowWsResponse doHandle(ShowRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto component = loadComponent(dbSession, request); Optional lastAnalysis = dbClient.snapshotDao().selectLastAnalysisByComponentUuid(dbSession, component.projectUuid()); @@ -116,7 +116,7 @@ public class ShowAction implements ComponentsWsAction { } } - private ComponentDto loadComponent(DbSession dbSession, ShowWsRequest request) { + private ComponentDto loadComponent(DbSession dbSession, ShowRequest request) { String componentId = request.getId(); String componentKey = request.getKey(); String branch = request.getBranch(); @@ -139,8 +139,8 @@ public class ShowAction implements ComponentsWsAction { return response.build(); } - private static ShowWsRequest toShowWsRequest(Request request) { - return new ShowWsRequest() + private static ShowRequest toShowWsRequest(Request request) { + return new ShowRequest() .setId(request.param(PARAM_COMPONENT_ID)) .setKey(request.param(PARAM_COMPONENT)) .setBranch(request.param(PARAM_BRANCH)); 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 1bd0014c0b0..e2c31ae4325 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 @@ -52,7 +52,7 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Components; import org.sonarqube.ws.Components.TreeWsResponse; -import org.sonarqube.ws.client.component.TreeWsRequest; +import org.sonarqube.ws.client.component.TreeRequest; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.CASE_INSENSITIVE_ORDER; @@ -170,26 +170,26 @@ public class TreeAction implements ComponentsWsAction { writeProtobuf(treeWsResponse, request, response); } - private TreeWsResponse doHandle(TreeWsRequest treeWsRequest) { + private TreeWsResponse doHandle(TreeRequest treeRequest) { try (DbSession dbSession = dbClient.openSession(false)) { - ComponentDto baseComponent = loadComponent(dbSession, treeWsRequest); + ComponentDto baseComponent = loadComponent(dbSession, treeRequest); checkPermissions(baseComponent); OrganizationDto organizationDto = componentFinder.getOrganization(dbSession, baseComponent); - ComponentTreeQuery query = toComponentTreeQuery(treeWsRequest, baseComponent); + ComponentTreeQuery query = toComponentTreeQuery(treeRequest, baseComponent); List components = dbClient.componentDao().selectDescendants(dbSession, query); int total = components.size(); - components = sortComponents(components, treeWsRequest); - components = paginateComponents(components, treeWsRequest); + components = sortComponents(components, treeRequest); + components = paginateComponents(components, treeRequest); Map referenceComponentsByUuid = searchReferenceComponentsByUuid(dbSession, components); return buildResponse(baseComponent, organizationDto, components, referenceComponentsByUuid, - Paging.forPageIndex(treeWsRequest.getPage()).withPageSize(treeWsRequest.getPageSize()).andTotal(total)); + Paging.forPageIndex(treeRequest.getPage()).withPageSize(treeRequest.getPageSize()).andTotal(total)); } } - private ComponentDto loadComponent(DbSession dbSession, TreeWsRequest request) { + private ComponentDto loadComponent(DbSession dbSession, TreeRequest request) { String componentId = request.getBaseComponentId(); String componentKey = request.getBaseComponentKey(); String branch = request.getBranch(); @@ -246,7 +246,7 @@ public class TreeAction implements ComponentsWsAction { return wsComponent; } - private ComponentTreeQuery toComponentTreeQuery(TreeWsRequest request, ComponentDto baseComponent) { + private ComponentTreeQuery toComponentTreeQuery(TreeRequest request, ComponentDto baseComponent) { List childrenQualifiers = childrenQualifiers(request, baseComponent.qualifier()); ComponentTreeQuery.Builder query = ComponentTreeQuery.builder() @@ -263,7 +263,7 @@ public class TreeAction implements ComponentsWsAction { } @CheckForNull - private List childrenQualifiers(TreeWsRequest request, String baseQualifier) { + private List childrenQualifiers(TreeRequest request, String baseQualifier) { List requestQualifiers = request.getQualifiers(); List childrenQualifiers = null; if (LEAVES_STRATEGY.equals(request.getStrategy())) { @@ -283,8 +283,8 @@ public class TreeAction implements ComponentsWsAction { return new ArrayList<>(qualifiersIntersection); } - private static TreeWsRequest toTreeWsRequest(Request request) { - return new TreeWsRequest() + private static TreeRequest toTreeWsRequest(Request request) { + return new TreeRequest() .setBaseComponentId(request.param(PARAM_COMPONENT_ID)) .setBaseComponentKey(request.param(PARAM_COMPONENT)) .setBranch(request.param(PARAM_BRANCH)) @@ -297,12 +297,12 @@ public class TreeAction implements ComponentsWsAction { .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)); } - private static List paginateComponents(List components, TreeWsRequest wsRequest) { + private static List paginateComponents(List components, TreeRequest wsRequest) { return components.stream().skip(offset(wsRequest.getPage(), wsRequest.getPageSize())) .limit(wsRequest.getPageSize()).collect(toList()); } - public static List sortComponents(List components, TreeWsRequest wsRequest) { + public static List sortComponents(List components, TreeRequest wsRequest) { List sortParameters = wsRequest.getSort(); if (sortParameters == null || sortParameters.isEmpty()) { return components; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryFactory.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryFactory.java index 63974471ac0..a4a2f341f48 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryFactory.java @@ -53,7 +53,7 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Lists.newArrayList; @@ -99,7 +99,7 @@ public class IssueQueryFactory { this.userSession = userSession; } - public IssueQuery create(SearchWsRequest request) { + public IssueQuery create(SearchRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { IssueQuery.Builder builder = IssueQuery.builder() .issueKeys(request.getIssues()) @@ -155,7 +155,7 @@ public class IssueQueryFactory { return organization.map(OrganizationDto::getUuid).orElse(UNKNOWN); } - private Date buildCreatedAfterFromRequest(DbSession dbSession, SearchWsRequest request, List componentUuids) { + private Date buildCreatedAfterFromRequest(DbSession dbSession, SearchRequest request, List componentUuids) { Date createdAfter = parseStartingDateOrDateTime(request.getCreatedAfter()); String createdInLast = request.getCreatedInLast(); @@ -192,7 +192,7 @@ public class IssueQueryFactory { return assignees; } - private boolean mergeDeprecatedComponentParameters(DbSession session, SearchWsRequest request, List allComponents) { + private boolean mergeDeprecatedComponentParameters(DbSession session, SearchRequest request, List allComponents) { Boolean onComponentOnly = request.getOnComponentOnly(); Collection components = request.getComponents(); Collection componentUuids = request.getComponentUuids(); @@ -232,7 +232,7 @@ public class IssueQueryFactory { } private void addComponentParameters(IssueQuery.Builder builder, DbSession session, boolean onComponentOnly, - List components, SearchWsRequest request) { + List components, SearchRequest request) { builder.onComponentOnly(onComponentOnly); if (onComponentOnly) { @@ -259,7 +259,7 @@ public class IssueQueryFactory { addComponentsBasedOnQualifier(builder, session, components, request); } - private void addComponentsBasedOnQualifier(IssueQuery.Builder builder, DbSession dbSession, List components, SearchWsRequest request) { + private void addComponentsBasedOnQualifier(IssueQuery.Builder builder, DbSession dbSession, List components, SearchRequest request) { if (components.isEmpty()) { return; } @@ -310,7 +310,7 @@ public class IssueQueryFactory { builder.viewUuids(filteredViewUuids); } - private void addApplications(IssueQuery.Builder builder, DbSession dbSession, List applications, SearchWsRequest request) { + private void addApplications(IssueQuery.Builder builder, DbSession dbSession, List applications, SearchRequest request) { Set authorizedApplicationUuids = applications.stream() .filter(app -> userSession.hasComponentPermission(UserRole.USER, app)) .map(ComponentDto::uuid) @@ -320,7 +320,7 @@ public class IssueQueryFactory { addCreatedAfterByProjects(builder, dbSession, request, authorizedApplicationUuids); } - private void addCreatedAfterByProjects(IssueQuery.Builder builder, DbSession dbSession, SearchWsRequest request, Set applicationUuids) { + private void addCreatedAfterByProjects(IssueQuery.Builder builder, DbSession dbSession, SearchRequest request, Set applicationUuids) { if (request.getSinceLeakPeriod() == null || !request.getSinceLeakPeriod()) { return; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ComponentTagsAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ComponentTagsAction.java index a28c041a372..5bb5d38c8f1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ComponentTagsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ComponentTagsAction.java @@ -29,7 +29,7 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.server.issue.IssueQuery; import org.sonar.server.issue.IssueQueryFactory; import org.sonar.server.issue.index.IssueIndex; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static java.util.Collections.singletonList; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; @@ -77,12 +77,12 @@ public class ComponentTagsAction implements IssuesWsAction { @Override public void handle(Request request, Response response) throws Exception { - SearchWsRequest searchWsRequest = new SearchWsRequest() + SearchRequest searchRequest = new SearchRequest() .setComponentUuids(singletonList(request.mandatoryParam(PARAM_COMPONENT_UUID))) .setResolved(false) .setCreatedAfter(request.param(PARAM_CREATED_AFTER)); - IssueQuery query = queryService.create(searchWsRequest); + IssueQuery query = queryService.create(searchRequest); int pageSize = request.mandatoryParamAsInt(PAGE_SIZE); try (JsonWriter json = response.newJsonWriter()) { json.beginObject().name("tags").beginArray(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 5293f0491c9..b8b744d83eb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -51,7 +51,7 @@ import org.sonar.server.issue.IssueQueryFactory; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Issues.SearchWsResponse; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Iterables.concat; @@ -319,7 +319,7 @@ public class SearchAction implements IssuesWsAction { writeProtobuf(searchWsResponse, request, response); } - private SearchWsResponse doHandle(SearchWsRequest request, Request wsRequest) { + private SearchWsResponse doHandle(SearchRequest request, Request wsRequest) { // prepare the Elasticsearch request SearchOptions options = createSearchOptionsFromRequest(request); EnumSet additionalFields = SearchAdditionalField.getFromRequest(request); @@ -366,7 +366,7 @@ public class SearchAction implements IssuesWsAction { return searchResponseFormat.formatSearch(additionalFields, data, paging, facets); } - private static SearchOptions createSearchOptionsFromRequest(SearchWsRequest request) { + private static SearchOptions createSearchOptionsFromRequest(SearchRequest request) { SearchOptions options = new SearchOptions(); options.setPage(request.getPage(), request.getPageSize()); options.addFacets(request.getFacets()); @@ -388,7 +388,7 @@ public class SearchAction implements IssuesWsAction { return new Facets(orderedFacets, system2.getDefaultTimeZone()); } - private void completeFacets(Facets facets, SearchWsRequest request, Request wsRequest) { + private void completeFacets(Facets facets, SearchRequest request, Request wsRequest) { addMandatoryValuesToFacet(facets, PARAM_SEVERITIES, Severity.ALL); addMandatoryValuesToFacet(facets, PARAM_STATUSES, Issue.STATUSES); addMandatoryValuesToFacet(facets, PARAM_RESOLUTIONS, concat(singletonList(""), Issue.RESOLUTIONS)); @@ -457,7 +457,7 @@ public class SearchAction implements IssuesWsAction { collector.addAll(SearchAdditionalField.USERS, facets.getBucketKeys(PARAM_ASSIGNEES)); } - private static void collectRequestParams(SearchResponseLoader.Collector collector, SearchWsRequest request) { + private static void collectRequestParams(SearchResponseLoader.Collector collector, SearchRequest request) { collector.addProjectUuids(request.getProjectUuids()); collector.addComponentUuids(request.getFileUuids()); collector.addComponentUuids(request.getModuleUuids()); @@ -465,8 +465,8 @@ public class SearchAction implements IssuesWsAction { collector.addAll(SearchAdditionalField.USERS, request.getAssignees()); } - private static SearchWsRequest toSearchWsRequest(Request request) { - return new SearchWsRequest() + private static SearchRequest toSearchWsRequest(Request request) { + return new SearchRequest() .setAdditionalFields(request.paramAsStrings(PARAM_ADDITIONAL_FIELDS)) .setAsc(request.paramAsBoolean(PARAM_ASC)) .setAssigned(request.paramAsBoolean(PARAM_ASSIGNED)) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java index f6c870335e4..0c8ef7e9224 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java @@ -26,7 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.CheckForNull; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; public enum SearchAdditionalField { @@ -68,7 +68,7 @@ public enum SearchAdditionalField { return possibles; } - public static EnumSet getFromRequest(SearchWsRequest request) { + public static EnumSet getFromRequest(SearchRequest request) { List labels = request.getAdditionalFields(); if (labels == null) { return EnumSet.noneOf(SearchAdditionalField.class); 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 03a8edd8eb7..fd5d78e90ef 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 @@ -53,7 +53,7 @@ import org.sonar.server.measure.ws.MetricDtoWithBestValue.MetricDtoToMetricDtoWi import org.sonar.server.user.UserSession; import org.sonarqube.ws.Measures; import org.sonarqube.ws.Measures.ComponentWsResponse; -import org.sonarqube.ws.client.measure.ComponentWsRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -138,7 +138,7 @@ public class ComponentAction implements MeasuresWsAction { writeProtobuf(componentWsResponse, request, response); } - private ComponentWsResponse doHandle(ComponentWsRequest request) { + private ComponentWsResponse doHandle(ComponentRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto component = loadComponent(dbSession, request); Long developerId = searchDeveloperId(dbSession, request); @@ -153,7 +153,7 @@ public class ComponentAction implements MeasuresWsAction { } } - private ComponentDto loadComponent(DbSession dbSession, ComponentWsRequest request) { + private ComponentDto loadComponent(DbSession dbSession, ComponentRequest request) { String componentKey = request.getComponent(); String componentId = request.getComponentId(); String branch = request.getBranch(); @@ -164,7 +164,7 @@ public class ComponentAction implements MeasuresWsAction { } @CheckForNull - private Long searchDeveloperId(DbSession dbSession, ComponentWsRequest request) { + private Long searchDeveloperId(DbSession dbSession, ComponentRequest request) { if (request.getDeveloperId() == null && request.getDeveloperKey() == null) { return null; } @@ -180,8 +180,8 @@ public class ComponentAction implements MeasuresWsAction { return dbClient.componentDao().selectByUuid(dbSession, component.getCopyResourceUuid()); } - private static ComponentWsResponse buildResponse(ComponentWsRequest request, ComponentDto component, Optional refComponent, List measures, - List metrics, List periods) { + private static ComponentWsResponse buildResponse(ComponentRequest request, ComponentDto component, Optional refComponent, List measures, + List metrics, List periods) { ComponentWsResponse.Builder response = ComponentWsResponse.newBuilder(); Map metricsById = Maps.uniqueIndex(metrics, MetricDto::getId); Map measuresByMetric = new HashMap<>(); @@ -210,7 +210,7 @@ public class ComponentAction implements MeasuresWsAction { return response.build(); } - private List searchMetrics(DbSession dbSession, ComponentWsRequest request) { + private List searchMetrics(DbSession dbSession, ComponentRequest request) { List metrics = dbClient.metricDao().selectByKeys(dbSession, request.getMetricKeys()); if (metrics.size() < request.getMetricKeys().size()) { List foundMetricKeys = Lists.transform(metrics, MetricDto::getKey); @@ -266,8 +266,8 @@ public class ComponentAction implements MeasuresWsAction { } } - private static ComponentWsRequest toComponentWsRequest(Request request) { - ComponentWsRequest componentWsRequest = new ComponentWsRequest() + private static ComponentRequest toComponentWsRequest(Request request) { + ComponentRequest componentRequest = new ComponentRequest() .setComponentId(request.param(DEPRECATED_PARAM_COMPONENT_ID)) .setComponent(request.param(PARAM_COMPONENT)) .setBranch(request.param(PARAM_BRANCH)) @@ -275,8 +275,8 @@ public class ComponentAction implements MeasuresWsAction { .setMetricKeys(request.mandatoryParamAsStrings(PARAM_METRIC_KEYS)) .setDeveloperId(request.param(PARAM_DEVELOPER_ID)) .setDeveloperKey(request.param(PARAM_DEVELOPER_KEY)); - checkRequest(!componentWsRequest.getMetricKeys().isEmpty(), "At least one metric key must be provided"); - return componentWsRequest; + checkRequest(!componentRequest.getMetricKeys().isEmpty(), "At least one metric key must be provided"); + return componentRequest; } private void checkPermissions(ComponentDto baseComponent) { 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 2423e61ee2f..b9f79a6beef 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 @@ -40,7 +40,7 @@ import org.sonar.db.component.ComponentTreeQuery.Strategy; import org.sonar.db.metric.MetricDto; import org.sonarqube.ws.Measures; import org.sonarqube.ws.Measures.ComponentTreeWsResponse; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -219,7 +219,7 @@ public class ComponentTreeAction implements MeasuresWsAction { writeProtobuf(componentTreeWsResponse, request, response); } - private ComponentTreeWsResponse doHandle(ComponentTreeWsRequest request) { + private ComponentTreeWsResponse doHandle(ComponentTreeRequest request) { ComponentTreeData data = dataLoader.load(request); if (data.getComponents() == null) { return emptyResponse(data.getBaseComponent(), request); @@ -234,7 +234,7 @@ public class ComponentTreeAction implements MeasuresWsAction { .andTotal(data.getComponentCount())); } - private static ComponentTreeWsResponse buildResponse(ComponentTreeWsRequest request, ComponentTreeData data, Paging paging) { + private static ComponentTreeWsResponse buildResponse(ComponentTreeRequest request, ComponentTreeData data, Paging paging) { ComponentTreeWsResponse.Builder response = ComponentTreeWsResponse.newBuilder(); response.getPagingBuilder() .setPageIndex(paging.pageIndex()) @@ -269,17 +269,17 @@ public class ComponentTreeAction implements MeasuresWsAction { return response.build(); } - private static boolean areMetricsInResponse(ComponentTreeWsRequest request) { + private static boolean areMetricsInResponse(ComponentTreeRequest request) { List additionalFields = request.getAdditionalFields(); return additionalFields != null && additionalFields.contains(ADDITIONAL_METRICS); } - private static boolean arePeriodsInResponse(ComponentTreeWsRequest request) { + private static boolean arePeriodsInResponse(ComponentTreeRequest request) { List additionalFields = request.getAdditionalFields(); return additionalFields != null && additionalFields.contains(ADDITIONAL_PERIODS); } - private static ComponentTreeWsResponse emptyResponse(ComponentDto baseComponent, ComponentTreeWsRequest request) { + private static ComponentTreeWsResponse emptyResponse(ComponentDto baseComponent, ComponentTreeRequest request) { ComponentTreeWsResponse.Builder response = ComponentTreeWsResponse.newBuilder(); response.getPagingBuilder() .setPageIndex(request.getPage()) @@ -289,10 +289,10 @@ public class ComponentTreeAction implements MeasuresWsAction { return response.build(); } - private static ComponentTreeWsRequest toComponentTreeWsRequest(Request request) { + private static ComponentTreeRequest toComponentTreeWsRequest(Request request) { List metricKeys = request.mandatoryParamAsStrings(PARAM_METRIC_KEYS); checkArgument(metricKeys.size() <= MAX_METRIC_KEYS, "Number of metrics keys is limited to %s, got %s", MAX_METRIC_KEYS, metricKeys.size()); - ComponentTreeWsRequest componentTreeWsRequest = new ComponentTreeWsRequest() + ComponentTreeRequest componentTreeRequest = new ComponentTreeRequest() .setBaseComponentId(request.param(DEPRECATED_PARAM_BASE_COMPONENT_ID)) .setComponent(request.param(PARAM_COMPONENT)) .setBranch(request.param(PARAM_BRANCH)) @@ -310,20 +310,20 @@ public class ComponentTreeAction implements MeasuresWsAction { .setPage(request.mandatoryParamAsInt(Param.PAGE)) .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)) .setQuery(request.param(Param.TEXT_QUERY)); - String metricSortValue = componentTreeWsRequest.getMetricSort(); - checkRequest(!componentTreeWsRequest.getMetricKeys().isEmpty(), "The '%s' parameter must contain at least one metric key", PARAM_METRIC_KEYS); - List sorts = Optional.ofNullable(componentTreeWsRequest.getSort()).orElse(emptyList()); + String metricSortValue = componentTreeRequest.getMetricSort(); + checkRequest(!componentTreeRequest.getMetricKeys().isEmpty(), "The '%s' parameter must contain at least one metric key", PARAM_METRIC_KEYS); + List sorts = Optional.ofNullable(componentTreeRequest.getSort()).orElse(emptyList()); checkRequest(metricSortValue == null ^ sorts.contains(METRIC_SORT) ^ sorts.contains(METRIC_PERIOD_SORT), "To sort by a metric, the '%s' parameter must contain '%s' or '%s', and a metric key must be provided in the '%s' parameter", Param.SORT, METRIC_SORT, METRIC_PERIOD_SORT, PARAM_METRIC_SORT); - checkRequest(metricSortValue == null ^ componentTreeWsRequest.getMetricKeys().contains(metricSortValue), + checkRequest(metricSortValue == null ^ componentTreeRequest.getMetricKeys().contains(metricSortValue), "To sort by the '%s' metric, it must be in the list of metric keys in the '%s' parameter", metricSortValue, PARAM_METRIC_KEYS); - checkRequest(componentTreeWsRequest.getMetricPeriodSort() == null ^ sorts.contains(METRIC_PERIOD_SORT), + checkRequest(componentTreeRequest.getMetricPeriodSort() == null ^ sorts.contains(METRIC_PERIOD_SORT), "To sort by a metric period, the '%s' parameter must contain '%s' and the '%s' must be provided.", Param.SORT, METRIC_PERIOD_SORT, PARAM_METRIC_PERIOD_SORT); - checkRequest(ALL_METRIC_SORT_FILTER.equals(componentTreeWsRequest.getMetricSortFilter()) || metricSortValue != null, + checkRequest(ALL_METRIC_SORT_FILTER.equals(componentTreeRequest.getMetricSortFilter()) || metricSortValue != null, "To filter components based on the sort metric, the '%s' parameter must contain '%s' or '%s' and the '%s' parameter must be provided", Param.SORT, METRIC_SORT, METRIC_PERIOD_SORT, PARAM_METRIC_SORT); - return componentTreeWsRequest; + return componentTreeRequest; } private static Measures.Component.Builder toWsComponent(ComponentDto component, Map measures, diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java index e599bb77803..fc2dba8ae1f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java @@ -60,7 +60,7 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.measure.ws.ComponentTreeData.Measure; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; @@ -93,7 +93,7 @@ public class ComponentTreeDataLoader { this.resourceTypes = resourceTypes; } - ComponentTreeData load(ComponentTreeWsRequest wsRequest) { + ComponentTreeData load(ComponentTreeRequest wsRequest) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto baseComponent = loadComponent(dbSession, wsRequest); checkPermissions(baseComponent); @@ -130,7 +130,7 @@ public class ComponentTreeDataLoader { } } - private ComponentDto loadComponent(DbSession dbSession, ComponentTreeWsRequest request) { + private ComponentDto loadComponent(DbSession dbSession, ComponentTreeRequest request) { String componentKey = request.getComponent(); String componentId = request.getBaseComponentId(); String branch = request.getBranch(); @@ -141,7 +141,7 @@ public class ComponentTreeDataLoader { } @CheckForNull - private Long searchDeveloperId(DbSession dbSession, ComponentTreeWsRequest wsRequest) { + private Long searchDeveloperId(DbSession dbSession, ComponentTreeRequest wsRequest) { if (wsRequest.getDeveloperId() == null && wsRequest.getDeveloperKey() == null) { return null; } @@ -170,7 +170,7 @@ public class ComponentTreeDataLoader { return dbClient.componentDao().selectDescendants(dbSession, componentTreeQuery); } - private List searchMetrics(DbSession dbSession, ComponentTreeWsRequest request) { + private List searchMetrics(DbSession dbSession, ComponentTreeRequest request) { List metricKeys = requireNonNull(request.getMetricKeys()); List metrics = dbClient.metricDao().selectByKeys(dbSession, metricKeys); if (metrics.size() < metricKeys.size()) { @@ -246,7 +246,7 @@ public class ComponentTreeDataLoader { } private static List filterComponents(List components, - Table measuresByComponentUuidAndMetric, List metrics, ComponentTreeWsRequest wsRequest) { + Table measuresByComponentUuidAndMetric, List metrics, ComponentTreeRequest wsRequest) { if (!componentWithMeasuresOnly(wsRequest)) { return components; } @@ -261,16 +261,16 @@ public class ComponentTreeDataLoader { .collect(MoreCollectors.toList(components.size())); } - private static boolean componentWithMeasuresOnly(ComponentTreeWsRequest wsRequest) { + private static boolean componentWithMeasuresOnly(ComponentTreeRequest wsRequest) { return WITH_MEASURES_ONLY_METRIC_SORT_FILTER.equals(wsRequest.getMetricSortFilter()); } - private static List sortComponents(List components, ComponentTreeWsRequest wsRequest, List metrics, - Table measuresByComponentUuidAndMetric) { + private static List sortComponents(List components, ComponentTreeRequest wsRequest, List metrics, + Table measuresByComponentUuidAndMetric) { return ComponentTreeSort.sortComponents(components, wsRequest, metrics, measuresByComponentUuidAndMetric); } - private static List paginateComponents(List components, ComponentTreeWsRequest wsRequest) { + private static List paginateComponents(List components, ComponentTreeRequest wsRequest) { return components.stream() .skip(offset(wsRequest.getPage(), wsRequest.getPageSize())) .limit(wsRequest.getPageSize()) @@ -278,7 +278,7 @@ public class ComponentTreeDataLoader { } @CheckForNull - private List childrenQualifiers(ComponentTreeWsRequest request, String baseQualifier) { + private List childrenQualifiers(ComponentTreeRequest request, String baseQualifier) { List requestQualifiers = request.getQualifiers(); List childrenQualifiers = null; if (LEAVES_STRATEGY.equals(request.getStrategy())) { @@ -298,7 +298,7 @@ public class ComponentTreeDataLoader { return new ArrayList<>(qualifiersIntersection); } - private ComponentTreeQuery toComponentTreeQuery(ComponentTreeWsRequest wsRequest, ComponentDto baseComponent) { + private ComponentTreeQuery toComponentTreeQuery(ComponentTreeRequest wsRequest, ComponentDto baseComponent) { List childrenQualifiers = childrenQualifiers(wsRequest, baseComponent.qualifier()); ComponentTreeQuery.Builder componentTreeQueryBuilder = ComponentTreeQuery.builder() diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java index af94995abd0..cf881dd6126 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java @@ -35,7 +35,7 @@ import org.sonar.api.measures.Metric.ValueType; import org.sonar.db.component.ComponentDto; import org.sonar.db.metric.MetricDto; import org.sonar.server.exceptions.BadRequestException; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; import static java.lang.String.CASE_INSENSITIVE_ORDER; import static java.lang.String.format; @@ -62,8 +62,8 @@ public class ComponentTreeSort { // static method only } - public static List sortComponents(List components, ComponentTreeWsRequest wsRequest, List metrics, - Table measuresByComponentUuidAndMetric) { + public static List sortComponents(List components, ComponentTreeRequest wsRequest, List metrics, + Table measuresByComponentUuidAndMetric) { List sortParameters = wsRequest.getSort(); if (sortParameters == null || sortParameters.isEmpty()) { return components; @@ -112,8 +112,8 @@ public class ComponentTreeSort { return ordering.nullsLast().onResultOf(function); } - private static Ordering metricValueOrdering(ComponentTreeWsRequest wsRequest, List metrics, - Table measuresByComponentUuidAndMetric) { + private static Ordering metricValueOrdering(ComponentTreeRequest wsRequest, List metrics, + Table measuresByComponentUuidAndMetric) { if (wsRequest.getMetricSort() == null) { return componentNameOrdering(wsRequest.getAsc()); } @@ -133,8 +133,8 @@ public class ComponentTreeSort { throw new IllegalStateException("Unrecognized metric value type: " + metric.getValueType()); } - private static Ordering metricPeriodOrdering(ComponentTreeWsRequest wsRequest, List metrics, - Table measuresByComponentUuidAndMetric) { + private static Ordering metricPeriodOrdering(ComponentTreeRequest wsRequest, List metrics, + Table measuresByComponentUuidAndMetric) { if (wsRequest.getMetricSort() == null || wsRequest.getMetricPeriodSort() == null) { return componentNameOrdering(wsRequest.getAsc()); } @@ -160,8 +160,8 @@ public class ComponentTreeSort { return ordering.nullsLast().onResultOf(new ComponentDtoToNumericalMeasureValue(metric, measuresByComponentUuidAndMetric)); } - private static Ordering numericalMetricPeriodOrdering(ComponentTreeWsRequest request, @Nullable MetricDto metric, - Table measuresByComponentUuidAndMetric) { + private static Ordering numericalMetricPeriodOrdering(ComponentTreeRequest request, @Nullable MetricDto metric, + Table measuresByComponentUuidAndMetric) { Ordering ordering = Ordering.natural(); if (!request.getAsc()) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java index 6893c6851bd..3f0b7ed5bdb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java @@ -24,14 +24,14 @@ import java.util.function.Predicate; import javax.annotation.Nonnull; import org.sonar.db.component.ComponentDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; import static org.sonar.server.measure.ws.ComponentTreeData.Measure; class HasMeasure implements Predicate { private final Predicate predicate; - HasMeasure(Table table, MetricDto metric, ComponentTreeWsRequest request) { + HasMeasure(Table table, MetricDto metric, ComponentTreeRequest request) { Integer periodIndex = request.getMetricPeriodSort(); this.predicate = periodIndex == null ? new HasAbsoluteValue(table, metric) 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 1782ae1ef81..2eb7531c944 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 @@ -39,7 +39,7 @@ import org.sonarqube.ws.Common; 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 org.sonarqube.ws.client.permission.SearchProjectPermissionsRequest; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameters; @@ -104,7 +104,7 @@ public class SearchProjectPermissionsAction implements PermissionsWsAction { writeProtobuf(searchProjectPermissionsWsResponse, wsRequest, wsResponse); } - private SearchProjectPermissionsWsResponse doHandle(SearchProjectPermissionsWsRequest request) { + private SearchProjectPermissionsWsResponse doHandle(SearchProjectPermissionsRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { checkAuthorized(dbSession, request); validateQualifier(request.getQualifier(), resourceTypes); @@ -113,8 +113,8 @@ public class SearchProjectPermissionsAction implements PermissionsWsAction { } } - private static SearchProjectPermissionsWsRequest toSearchProjectPermissionsWsRequest(Request request) { - return new SearchProjectPermissionsWsRequest() + private static SearchProjectPermissionsRequest toSearchProjectPermissionsWsRequest(Request request) { + return new SearchProjectPermissionsRequest() .setProjectId(request.param(PARAM_PROJECT_ID)) .setProjectKey(request.param(PARAM_PROJECT_KEY)) .setQualifier(request.param(PARAM_QUALIFIER)) @@ -123,7 +123,7 @@ public class SearchProjectPermissionsAction implements PermissionsWsAction { .setQuery(request.param(Param.TEXT_QUERY)); } - private void checkAuthorized(DbSession dbSession, SearchProjectPermissionsWsRequest request) { + private void checkAuthorized(DbSession dbSession, SearchProjectPermissionsRequest request) { com.google.common.base.Optional projectRef = newOptionalWsProjectRef(request.getProjectId(), request.getProjectKey()); if (projectRef.isPresent()) { ComponentDto project = wsSupport.getRootComponentOrModule(dbSession, projectRef.get()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsDataLoader.java index ef9dabdcb7e..973144fcd19 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsDataLoader.java @@ -34,7 +34,7 @@ import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentQuery; import org.sonar.db.permission.CountPerProjectPermission; -import org.sonarqube.ws.client.permission.SearchProjectPermissionsWsRequest; +import org.sonarqube.ws.client.permission.SearchProjectPermissionsRequest; import static java.util.Collections.singletonList; import static org.sonar.api.utils.Paging.forPageIndex; @@ -52,7 +52,7 @@ public class SearchProjectPermissionsDataLoader { this.rootQualifiers = Collections2.transform(resourceTypes.getRoots(), ResourceType::getQualifier).toArray(new String[resourceTypes.getRoots().size()]); } - SearchProjectPermissionsData load(DbSession dbSession, SearchProjectPermissionsWsRequest request) { + SearchProjectPermissionsData load(DbSession dbSession, SearchProjectPermissionsRequest request) { SearchProjectPermissionsData.Builder data = newBuilder(); int countRootComponents = countRootComponents(dbSession, request); List rootComponents = searchRootComponents(dbSession, request, paging(request, countRootComponents)); @@ -66,17 +66,17 @@ public class SearchProjectPermissionsDataLoader { return data.build(); } - private static Paging paging(SearchProjectPermissionsWsRequest request, int total) { + private static Paging paging(SearchProjectPermissionsRequest request, int total) { return forPageIndex(request.getPage()) .withPageSize(request.getPageSize()) .andTotal(total); } - private int countRootComponents(DbSession dbSession, SearchProjectPermissionsWsRequest request) { + private int countRootComponents(DbSession dbSession, SearchProjectPermissionsRequest request) { return dbClient.componentDao().countByQuery(dbSession, toDbQuery(request)); } - private List searchRootComponents(DbSession dbSession, SearchProjectPermissionsWsRequest request, Paging paging) { + private List searchRootComponents(DbSession dbSession, SearchProjectPermissionsRequest request, Paging paging) { Optional project = newOptionalWsProjectRef(request.getProjectId(), request.getProjectKey()); if (project.isPresent()) { @@ -86,7 +86,7 @@ public class SearchProjectPermissionsDataLoader { return dbClient.componentDao().selectByQuery(dbSession, toDbQuery(request), paging.offset(), paging.pageSize()); } - private ComponentQuery toDbQuery(SearchProjectPermissionsWsRequest wsRequest) { + private ComponentQuery toDbQuery(SearchProjectPermissionsRequest wsRequest) { return ComponentQuery.builder() .setQualifiers(qualifiers(wsRequest.getQualifier())) .setNameOrKeyQuery(wsRequest.getQuery()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateAction.java index f694f5ec6c4..0d4956088e2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateAction.java @@ -31,7 +31,7 @@ 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.client.permission.AddProjectCreatorToTemplateWsRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; @@ -55,8 +55,8 @@ public class AddProjectCreatorToTemplateAction implements PermissionsWsAction { this.system = system; } - private static AddProjectCreatorToTemplateWsRequest toWsRequest(Request request) { - AddProjectCreatorToTemplateWsRequest wsRequest = AddProjectCreatorToTemplateWsRequest.builder() + private static AddProjectCreatorToTemplateRequest toWsRequest(Request request) { + AddProjectCreatorToTemplateRequest wsRequest = AddProjectCreatorToTemplateRequest.builder() .setPermission(request.mandatoryParam(PARAM_PERMISSION)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) .setOrganization(request.param(PARAM_ORGANIZATION)) @@ -85,7 +85,7 @@ public class AddProjectCreatorToTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(AddProjectCreatorToTemplateWsRequest request) { + private void doHandle(AddProjectCreatorToTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { PermissionTemplateDto template = wsSupport.findTemplate(dbSession, WsTemplateRef.newTemplateRef( request.getTemplateId(), request.getOrganization(), request.getTemplateName())); @@ -101,7 +101,7 @@ public class AddProjectCreatorToTemplateAction implements PermissionsWsAction { } } - private void addTemplatePermission(DbSession dbSession, AddProjectCreatorToTemplateWsRequest request, PermissionTemplateDto template) { + private void addTemplatePermission(DbSession dbSession, AddProjectCreatorToTemplateRequest request, PermissionTemplateDto template) { long now = system.now(); dbClient.permissionTemplateCharacteristicDao().insert(dbSession, new PermissionTemplateCharacteristicDto() .setPermission(request.getPermission()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddUserToTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddUserToTemplateAction.java index 75f2b02f408..5c38b5a5ab7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddUserToTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddUserToTemplateAction.java @@ -32,7 +32,7 @@ import org.sonar.server.permission.UserId; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; +import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter; @@ -56,8 +56,8 @@ public class AddUserToTemplateAction implements PermissionsWsAction { this.userSession = userSession; } - private static AddUserToTemplateWsRequest toAddUserToTemplateWsRequest(Request request) { - return new AddUserToTemplateWsRequest() + private static AddUserToTemplateRequest toAddUserToTemplateWsRequest(Request request) { + return new AddUserToTemplateRequest() .setLogin(request.mandatoryParam(PARAM_USER_LOGIN)) .setPermission(request.mandatoryParam(PARAM_PERMISSION)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) @@ -86,7 +86,7 @@ public class AddUserToTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(AddUserToTemplateWsRequest request) { + private void doHandle(AddUserToTemplateRequest request) { String permission = request.getPermission(); String userLogin = request.getLogin(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java index 7847af840fd..655d3a866f5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java @@ -31,7 +31,7 @@ import org.sonar.server.permission.PermissionTemplateService; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.permission.ApplyTemplateWsRequest; +import org.sonarqube.ws.client.permission.ApplyTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameters; @@ -58,8 +58,8 @@ public class ApplyTemplateAction implements PermissionsWsAction { this.wsSupport = wsSupport; } - private static ApplyTemplateWsRequest toApplyTemplateWsRequest(Request request) { - return new ApplyTemplateWsRequest() + private static ApplyTemplateRequest toApplyTemplateWsRequest(Request request) { + return new ApplyTemplateRequest() .setProjectId(request.param(PARAM_PROJECT_ID)) .setProjectKey(request.param(PARAM_PROJECT_KEY)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) @@ -88,7 +88,7 @@ public class ApplyTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(ApplyTemplateWsRequest request) { + private void doHandle(ApplyTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { PermissionTemplateDto template = wsSupport.findTemplate(dbSession, newTemplateRef( request.getTemplateId(), request.getOrganization(), request.getTemplateName())); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/BulkApplyTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/BulkApplyTemplateAction.java index b5cdd5f896e..e2f82dfc576 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/BulkApplyTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/BulkApplyTemplateAction.java @@ -39,7 +39,7 @@ import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.permission.BulkApplyTemplateWsRequest; +import org.sonarqube.ws.client.permission.BulkApplyTemplateRequest; import static org.sonar.api.utils.DateUtils.parseDateOrDateTime; import static org.sonar.core.util.Protobuf.setNullable; @@ -137,7 +137,7 @@ public class BulkApplyTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(BulkApplyTemplateWsRequest request) { + private void doHandle(BulkApplyTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { PermissionTemplateDto template = wsSupport.findTemplate(dbSession, newTemplateRef( request.getTemplateId(), request.getOrganization(), request.getTemplateName())); @@ -150,8 +150,8 @@ public class BulkApplyTemplateAction implements PermissionsWsAction { } } - private static BulkApplyTemplateWsRequest toBulkApplyTemplateWsRequest(Request request) { - return new BulkApplyTemplateWsRequest() + private static BulkApplyTemplateRequest toBulkApplyTemplateWsRequest(Request request) { + return new BulkApplyTemplateRequest() .setOrganization(request.param(PARAM_ORGANIZATION)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) .setTemplateName(request.param(PARAM_TEMPLATE_NAME)) @@ -163,7 +163,7 @@ public class BulkApplyTemplateAction implements PermissionsWsAction { .setProjects(request.paramAsStrings(PARAM_PROJECTS)); } - private static ComponentQuery buildDbQuery(BulkApplyTemplateWsRequest request) { + private static ComponentQuery buildDbQuery(BulkApplyTemplateRequest request) { Collection qualifiers = request.getQualifiers(); ComponentQuery.Builder query = ComponentQuery.builder() .setQualifiers(qualifiers.toArray(new String[qualifiers.size()])); 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 91ba4eaf243..216cec4e230 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 @@ -34,7 +34,7 @@ import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Permissions.CreateTemplateWsResponse; import org.sonarqube.ws.Permissions.PermissionTemplate; -import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; +import org.sonarqube.ws.client.permission.CreateTemplateRequest; import static java.lang.String.format; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; @@ -65,8 +65,8 @@ public class CreateTemplateAction implements PermissionsWsAction { this.wsSupport = wsSupport; } - private static CreateTemplateWsRequest toCreateTemplateWsRequest(Request request) { - return new CreateTemplateWsRequest() + private static CreateTemplateRequest toCreateTemplateWsRequest(Request request) { + return new CreateTemplateRequest() .setName(request.mandatoryParam(PARAM_NAME)) .setDescription(request.param(PARAM_DESCRIPTION)) .setProjectKeyPattern(request.param(PARAM_PROJECT_KEY_PATTERN)) @@ -104,7 +104,7 @@ public class CreateTemplateAction implements PermissionsWsAction { writeProtobuf(createTemplateWsResponse, request, response); } - private CreateTemplateWsResponse doHandle(CreateTemplateWsRequest request) { + private CreateTemplateWsResponse doHandle(CreateTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto org = wsSupport.findOrganization(dbSession, request.getOrganization()); checkGlobalAdmin(userSession, org.getUuid()); @@ -126,7 +126,7 @@ public class CreateTemplateAction implements PermissionsWsAction { checkRequest(permissionTemplateWithSameName == null, format(MSG_TEMPLATE_WITH_SAME_NAME, name)); } - private PermissionTemplateDto insertTemplate(DbSession dbSession, OrganizationDto org, CreateTemplateWsRequest request) { + private PermissionTemplateDto insertTemplate(DbSession dbSession, OrganizationDto org, CreateTemplateRequest request) { Date now = new Date(system.now()); PermissionTemplateDto template = dbClient.permissionTemplateDao().insert(dbSession, new PermissionTemplateDto() .setUuid(Uuids.create()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/DeleteTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/DeleteTemplateAction.java index 0ae76ba8f69..821364c7fe0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/DeleteTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/DeleteTemplateAction.java @@ -29,7 +29,7 @@ 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.client.permission.DeleteTemplateWsRequest; +import org.sonarqube.ws.client.permission.DeleteTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters; @@ -53,8 +53,8 @@ public class DeleteTemplateAction implements PermissionsWsAction { this.defaultTemplatesResolver = defaultTemplatesResolver; } - private static DeleteTemplateWsRequest toDeleteTemplateWsRequest(Request request) { - return new DeleteTemplateWsRequest() + private static DeleteTemplateRequest toDeleteTemplateWsRequest(Request request) { + return new DeleteTemplateRequest() .setTemplateId(request.param(PARAM_TEMPLATE_ID)) .setOrganization(request.param(PARAM_ORGANIZATION)) .setTemplateName(request.param(PARAM_TEMPLATE_NAME)); @@ -79,7 +79,7 @@ public class DeleteTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(DeleteTemplateWsRequest request) { + private void doHandle(DeleteTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { PermissionTemplateDto template = finder.findTemplate(dbSession, newTemplateRef( request.getTemplateId(), request.getOrganization(), request.getTemplateName())); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateAction.java index 813efee8b10..2ff3728cb0b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateAction.java @@ -31,7 +31,7 @@ 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.client.permission.RemoveProjectCreatorFromTemplateWsRequest; +import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; @@ -55,8 +55,8 @@ public class RemoveProjectCreatorFromTemplateAction implements PermissionsWsActi this.system = system; } - private static RemoveProjectCreatorFromTemplateWsRequest toWsRequest(Request request) { - RemoveProjectCreatorFromTemplateWsRequest wsRequest = RemoveProjectCreatorFromTemplateWsRequest.builder() + private static RemoveProjectCreatorFromTemplateRequest toWsRequest(Request request) { + RemoveProjectCreatorFromTemplateRequest wsRequest = RemoveProjectCreatorFromTemplateRequest.builder() .setPermission(request.mandatoryParam(PARAM_PERMISSION)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) .setOrganization(request.param(PARAM_ORGANIZATION)) @@ -85,7 +85,7 @@ public class RemoveProjectCreatorFromTemplateAction implements PermissionsWsActi response.noContent(); } - private void doHandle(RemoveProjectCreatorFromTemplateWsRequest request) { + private void doHandle(RemoveProjectCreatorFromTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { PermissionTemplateDto template = wsSupport.findTemplate(dbSession, WsTemplateRef.newTemplateRef( request.getTemplateId(), request.getOrganization(), request.getTemplateName())); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateAction.java index 6ce9f1f5e76..f91d243ae2c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateAction.java @@ -29,7 +29,7 @@ import org.sonar.server.permission.UserId; import org.sonar.server.permission.ws.PermissionWsSupport; import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.permission.RemoveUserFromTemplateWsRequest; +import org.sonarqube.ws.client.permission.RemoveUserFromTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; @@ -53,8 +53,8 @@ public class RemoveUserFromTemplateAction implements PermissionsWsAction { this.userSession = userSession; } - private static RemoveUserFromTemplateWsRequest toRemoveUserFromTemplateWsRequest(Request request) { - return new RemoveUserFromTemplateWsRequest() + private static RemoveUserFromTemplateRequest toRemoveUserFromTemplateWsRequest(Request request) { + return new RemoveUserFromTemplateRequest() .setPermission(request.mandatoryParam(PARAM_PERMISSION)) .setLogin(request.mandatoryParam(PARAM_USER_LOGIN)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) @@ -83,7 +83,7 @@ public class RemoveUserFromTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(RemoveUserFromTemplateWsRequest request) { + private void doHandle(RemoveUserFromTemplateRequest request) { String permission = request.getPermission(); String userLogin = request.getLogin(); 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 87266ae544e..29e68967dd0 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 @@ -39,7 +39,7 @@ 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 org.sonarqube.ws.client.permission.SearchTemplatesRequest; import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.core.util.Protobuf.setNullable; @@ -83,7 +83,7 @@ public class SearchTemplatesAction implements PermissionsWsAction { public void handle(Request wsRequest, Response wsResponse) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto org = support.findOrganization(dbSession, wsRequest.param(PARAM_ORGANIZATION)); - SearchTemplatesWsRequest request = new SearchTemplatesWsRequest() + SearchTemplatesRequest request = new SearchTemplatesRequest() .setOrganizationUuid(org.getUuid()) .setQuery(wsRequest.param(Param.TEXT_QUERY)); checkGlobalAdmin(userSession, request.getOrganizationUuid()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java index 20cc847c804..c95aa7f3132 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java @@ -30,7 +30,7 @@ import org.sonar.db.permission.template.CountByTemplateAndPermissionDto; import org.sonar.db.permission.template.PermissionTemplateCharacteristicDto; import org.sonar.db.permission.template.PermissionTemplateDto; import org.sonar.server.permission.ws.template.DefaultTemplatesResolver.ResolvedDefaultTemplates; -import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; +import org.sonarqube.ws.client.permission.SearchTemplatesRequest; import static org.sonar.server.permission.ws.template.SearchTemplatesData.builder; import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; @@ -44,7 +44,7 @@ public class SearchTemplatesDataLoader { this.defaultTemplatesResolver = defaultTemplatesResolver; } - public SearchTemplatesData load(DbSession dbSession, SearchTemplatesWsRequest request) { + public SearchTemplatesData load(DbSession dbSession, SearchTemplatesRequest request) { SearchTemplatesData.Builder data = builder(); List templates = searchTemplates(dbSession, request); List templateIds = Lists.transform(templates, PermissionTemplateDto::getId); @@ -63,7 +63,7 @@ public class SearchTemplatesDataLoader { return data.build(); } - private List searchTemplates(DbSession dbSession, SearchTemplatesWsRequest request) { + private List searchTemplates(DbSession dbSession, SearchTemplatesRequest request) { return dbClient.permissionTemplateDao().selectAll(dbSession, request.getOrganizationUuid(), request.getQuery()); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SetDefaultTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SetDefaultTemplateAction.java index 49eca0a59ff..ea9ed0b4e71 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SetDefaultTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SetDefaultTemplateAction.java @@ -33,7 +33,7 @@ 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.client.permission.SetDefaultTemplateWsRequest; +import org.sonarqube.ws.client.permission.SetDefaultTemplateRequest; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier; @@ -63,8 +63,8 @@ public class SetDefaultTemplateAction implements PermissionsWsAction { this.i18n = i18n; } - private static SetDefaultTemplateWsRequest toSetDefaultTemplateWsRequest(Request request) { - return new SetDefaultTemplateWsRequest() + private static SetDefaultTemplateRequest toSetDefaultTemplateWsRequest(Request request) { + return new SetDefaultTemplateRequest() .setQualifier(request.param(PARAM_QUALIFIER)) .setTemplateId(request.param(PARAM_TEMPLATE_ID)) .setOrganization(request.param(PARAM_ORGANIZATION)) @@ -91,7 +91,7 @@ public class SetDefaultTemplateAction implements PermissionsWsAction { response.noContent(); } - private void doHandle(SetDefaultTemplateWsRequest request) { + private void doHandle(SetDefaultTemplateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { String qualifier = request.getQualifier(); PermissionTemplateDto template = findTemplate(dbSession, request); @@ -102,7 +102,7 @@ public class SetDefaultTemplateAction implements PermissionsWsAction { } } - private PermissionTemplateDto findTemplate(DbSession dbSession, SetDefaultTemplateWsRequest request) { + private PermissionTemplateDto findTemplate(DbSession dbSession, SetDefaultTemplateRequest request) { return wsSupport.findTemplate(dbSession, newTemplateRef(request.getTemplateId(), request.getOrganization(), request.getTemplateName())); } 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 b2a38561c75..94f59901b1e 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 @@ -33,7 +33,7 @@ import org.sonar.server.permission.ws.PermissionsWsAction; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Permissions.PermissionTemplate; import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; -import org.sonarqube.ws.client.permission.UpdateTemplateWsRequest; +import org.sonarqube.ws.client.permission.UpdateTemplateRequest; import static com.google.common.base.MoreObjects.firstNonNull; import static java.lang.String.format; @@ -65,8 +65,8 @@ public class UpdateTemplateAction implements PermissionsWsAction { this.wsSupport = wsSupport; } - private static UpdateTemplateWsRequest toUpdateTemplateWsRequest(Request request) { - return new UpdateTemplateWsRequest() + private static UpdateTemplateRequest toUpdateTemplateWsRequest(Request request) { + return new UpdateTemplateRequest() .setId(request.mandatoryParam(PARAM_ID)) .setName(request.param(PARAM_NAME)) .setDescription(request.param(PARAM_DESCRIPTION)) @@ -104,7 +104,7 @@ public class UpdateTemplateAction implements PermissionsWsAction { writeProtobuf(updateTemplateWsResponse, request, response); } - private UpdateTemplateWsResponse doHandle(UpdateTemplateWsRequest request) { + private UpdateTemplateWsResponse doHandle(UpdateTemplateRequest request) { String uuid = request.getId(); String nameParam = request.getName(); String descriptionParam = request.getDescription(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java index ec129767b14..a220e876149 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java @@ -31,7 +31,7 @@ import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.component.ComponentCleanerService; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import static org.sonar.api.resources.Qualifiers.APP; import static org.sonar.api.resources.Qualifiers.PROJECT; @@ -127,7 +127,7 @@ public class BulkDeleteAction implements ProjectsWsAction { @Override public void handle(Request request, Response response) throws Exception { - SearchWsRequest searchRequest = toSearchWsRequest(request); + SearchRequest searchRequest = toSearchWsRequest(request); userSession.checkLoggedIn(); try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = support.getOrganization(dbSession, searchRequest.getOrganization()); @@ -140,8 +140,8 @@ public class BulkDeleteAction implements ProjectsWsAction { response.noContent(); } - private static SearchWsRequest toSearchWsRequest(Request request) { - return SearchWsRequest.builder() + private static SearchRequest toSearchWsRequest(Request request) { + return SearchRequest.builder() .setOrganization(request.param(PARAM_ORGANIZATION)) .setQualifiers(request.mandatoryParamAsStrings(PARAM_QUALIFIERS)) .setQuery(request.param(Param.TEXT_QUERY)) 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 9eefaa3f91b..d2a8cc844eb 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 @@ -36,7 +36,7 @@ import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.component.ComponentService; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse; -import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest; +import org.sonarqube.ws.client.project.BulkUpdateKeyRequest; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.db.component.ComponentKeyUpdaterDao.checkIsProjectOrModule; @@ -131,7 +131,7 @@ public class BulkUpdateKeyAction implements ProjectsWsAction { writeProtobuf(doHandle(toWsRequest(request)), request, response); } - private BulkUpdateKeyWsResponse doHandle(BulkUpdateKeyWsRequest request) { + private BulkUpdateKeyWsResponse doHandle(BulkUpdateKeyRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto projectOrModule = componentFinder.getByUuidOrKey(dbSession, request.getId(), request.getKey(), ParamNames.ID_AND_KEY); checkIsProjectOrModule(projectOrModule); @@ -153,7 +153,7 @@ public class BulkUpdateKeyAction implements ProjectsWsAction { newKeysWithDuplicateMap.entrySet().forEach(entry -> checkRequest(!entry.getValue(), "Impossible to update key: a component with key \"%s\" already exists.", entry.getKey())); } - private void bulkUpdateKey(DbSession dbSession, BulkUpdateKeyWsRequest request, ComponentDto projectOrModule) { + private void bulkUpdateKey(DbSession dbSession, BulkUpdateKeyRequest request, ComponentDto projectOrModule) { componentService.bulkUpdateKey(dbSession, projectOrModule, request.getFrom(), request.getTo()); } @@ -175,8 +175,8 @@ public class BulkUpdateKeyAction implements ProjectsWsAction { return response.build(); } - private static BulkUpdateKeyWsRequest toWsRequest(Request request) { - return BulkUpdateKeyWsRequest.builder() + private static BulkUpdateKeyRequest toWsRequest(Request request) { + return BulkUpdateKeyRequest.builder() .setId(request.param(PARAM_PROJECT_ID)) .setKey(request.param(PARAM_PROJECT)) .setFrom(request.mandatoryParam(PARAM_FROM)) 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 f9f1dab3ee1..9ef198b33b2 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 @@ -40,7 +40,7 @@ import org.sonar.db.permission.OrganizationPermission; import org.sonar.server.project.Visibility; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Projects.SearchWsResponse; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.api.resources.Qualifiers.APP; @@ -147,8 +147,8 @@ public class SearchAction implements ProjectsWsAction { writeProtobuf(searchWsResponse, wsRequest, wsResponse); } - private static SearchWsRequest toSearchWsRequest(Request request) { - return SearchWsRequest.builder() + private static SearchRequest toSearchWsRequest(Request request) { + return SearchRequest.builder() .setOrganization(request.param(PARAM_ORGANIZATION)) .setQualifiers(request.mandatoryParamAsStrings(PARAM_QUALIFIERS)) .setQuery(request.param(Param.TEXT_QUERY)) @@ -162,7 +162,7 @@ public class SearchAction implements ProjectsWsAction { .build(); } - private SearchWsResponse doHandle(SearchWsRequest request) { + private SearchWsResponse doHandle(SearchRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = support.getOrganization(dbSession, request.getOrganization()); userSession.checkPermission(OrganizationPermission.ADMINISTER, organization); @@ -177,7 +177,7 @@ public class SearchAction implements ProjectsWsAction { } } - static ComponentQuery buildDbQuery(SearchWsRequest request) { + static ComponentQuery buildDbQuery(SearchRequest request) { List qualifiers = request.getQualifiers(); ComponentQuery.Builder query = ComponentQuery.builder() .setQualifiers(qualifiers.toArray(new String[qualifiers.size()])); @@ -196,7 +196,7 @@ public class SearchAction implements ProjectsWsAction { return query.build(); } - private Paging buildPaging(DbSession dbSession, SearchWsRequest request, OrganizationDto organization, ComponentQuery query) { + private Paging buildPaging(DbSession dbSession, SearchRequest request, OrganizationDto organization, ComponentQuery query) { int total = dbClient.componentDao().countByQuery(dbSession, organization.getUuid(), query); return Paging.forPageIndex(request.getPage()) .withPageSize(request.getPageSize()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java index 4f14b4793e8..49e79a01085 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java @@ -30,7 +30,7 @@ import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.component.ComponentService; -import org.sonarqube.ws.client.project.UpdateKeyWsRequest; +import org.sonarqube.ws.client.project.UpdateKeyRequest; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_UPDATE_KEY; @@ -97,15 +97,15 @@ public class UpdateKeyAction implements ProjectsWsAction { response.noContent(); } - private void doHandle(UpdateKeyWsRequest request) { + private void doHandle(UpdateKeyRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto projectOrModule = componentFinder.getByUuidOrKey(dbSession, request.getId(), request.getKey(), ParamNames.PROJECT_ID_AND_FROM); componentService.updateKey(dbSession, projectOrModule, request.getNewKey()); } } - private static UpdateKeyWsRequest toWsRequest(Request request) { - return UpdateKeyWsRequest.builder() + private static UpdateKeyRequest toWsRequest(Request request) { + return UpdateKeyRequest.builder() .setId(request.param(PARAM_PROJECT_ID)) .setKey(request.param(PARAM_FROM)) .setNewKey(request.mandatoryParam(PARAM_TO)) 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 3e90a178b13..892096abe07 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 @@ -52,7 +52,7 @@ 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.client.qualityprofile.SearchWsRequest; +import org.sonarqube.ws.client.qualityprofile.SearchRequest; import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; @@ -132,8 +132,8 @@ public class SearchAction implements QProfileWsAction { writeProtobuf(searchWsResponse, request, response); } - private static SearchWsRequest toSearchWsRequest(Request request) { - return new SearchWsRequest() + private static SearchRequest toSearchWsRequest(Request request) { + return new SearchRequest() .setOrganizationKey(request.param(PARAM_ORGANIZATION)) .setProjectKey(request.param(PARAM_PROJECT)) .setQualityProfile(request.param(PARAM_QUALITY_PROFILE)) @@ -141,12 +141,12 @@ public class SearchAction implements QProfileWsAction { .setLanguage(request.param(PARAM_LANGUAGE)); } - private SearchWsResponse doHandle(SearchWsRequest request) { + private SearchWsResponse doHandle(SearchRequest request) { SearchData data = load(request); return buildResponse(data); } - private SearchData load(SearchWsRequest request) { + private SearchData load(SearchRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, request.getOrganizationKey()); @@ -172,7 +172,7 @@ public class SearchAction implements QProfileWsAction { } @CheckForNull - private ComponentDto findProject(DbSession dbSession, OrganizationDto organization, SearchWsRequest request) { + private ComponentDto findProject(DbSession dbSession, OrganizationDto organization, SearchRequest request) { if (request.getProjectKey() == null) { return null; } @@ -205,7 +205,7 @@ public class SearchAction implements QProfileWsAction { .collect(toList()); } - private List searchProfiles(DbSession dbSession, SearchWsRequest request, OrganizationDto organization, List defaultProfiles, + private List searchProfiles(DbSession dbSession, SearchRequest request, OrganizationDto organization, List defaultProfiles, @Nullable ComponentDto project) { Collection profiles = selectAllProfiles(dbSession, organization); @@ -223,15 +223,15 @@ public class SearchAction implements QProfileWsAction { return p -> languages.get(p.getLanguage()) != null; } - private static Predicate byName(SearchWsRequest request) { + private static Predicate byName(SearchRequest request) { return p -> request.getQualityProfile() == null || Objects.equals(p.getName(), request.getQualityProfile()); } - private static Predicate byLanguage(SearchWsRequest request) { + private static Predicate byLanguage(SearchRequest request) { return p -> request.getLanguage() == null || Objects.equals(p.getLanguage(), request.getLanguage()); } - private static Predicate byDefault(SearchWsRequest request, List defaultProfiles) { + private static Predicate byDefault(SearchRequest request, List defaultProfiles) { Set defaultProfileUuids = defaultProfiles.stream().map(QProfileDto::getKee).collect(Collectors.toSet()); return p -> !request.getDefaults() || defaultProfileUuids.contains(p.getKee()); } 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 98357f4b30c..2a94d9e999d 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 @@ -53,7 +53,7 @@ import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.Components.Component; import org.sonarqube.ws.Components.SearchWsResponse; -import org.sonarqube.ws.client.component.SearchWsRequest; +import org.sonarqube.ws.client.component.SearchRequest; import static java.util.Arrays.asList; import static java.util.Collections.emptySet; @@ -140,7 +140,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-_%-key"), ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-key-without-escaped-characters")); - SearchWsResponse response = call(new SearchWsRequest().setQuery("project-_%-key").setQualifiers(singletonList(PROJECT))); + SearchWsResponse response = call(new SearchRequest().setQuery("project-_%-key").setQualifiers(singletonList(PROJECT))); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("project-_%-key"); } @@ -153,7 +153,7 @@ public class SearchActionTest { db.components().insertComponents(project, file1, file2); setBrowsePermissionOnUserAndIndex(project); - SearchWsResponse response = call(new SearchWsRequest().setQuery(file1.getDbKey()).setQualifiers(singletonList(FILE))); + SearchWsResponse response = call(new SearchRequest().setQuery(file1.getDbKey()).setQualifiers(singletonList(FILE))); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getDbKey()); } @@ -167,7 +167,7 @@ public class SearchActionTest { } insertProjectsAuthorizedForUser(componentDtoList.toArray(new ComponentDto[] {})); - SearchWsResponse response = call(new SearchWsRequest().setOrganization(organizationDto.getKey()).setPage(2).setPageSize(3).setQualifiers(singletonList(PROJECT))); + SearchWsResponse response = call(new SearchRequest().setOrganization(organizationDto.getKey()).setPage(2).setPageSize(3).setQualifiers(singletonList(PROJECT))); assertThat(response.getComponentsList()).extracting(Component::getKey).containsExactly("project-key-4", "project-key-5", "project-key-6"); } @@ -179,7 +179,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("java-project").setLanguage("java"), ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("cpp-project").setLanguage("cpp")); - SearchWsResponse response = call(new SearchWsRequest().setOrganization(organizationDto.getKey()).setLanguage("java").setQualifiers(singletonList(PROJECT))); + SearchWsResponse response = call(new SearchRequest().setOrganization(organizationDto.getKey()).setLanguage("java").setQualifiers(singletonList(PROJECT))); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("java-project"); } @@ -194,7 +194,7 @@ public class SearchActionTest { db.components().insertComponents(project1, file1, file2, project2, file3); setBrowsePermissionOnUserAndIndex(project1); - SearchWsResponse response = call(new SearchWsRequest().setQualifiers(singletonList(FILE))); + SearchWsResponse response = call(new SearchRequest().setQualifiers(singletonList(FILE))); assertThat(response.getComponentsList()).extracting(Component::getKey) .containsExactlyInAnyOrder(file1.getDbKey(), file2.getDbKey()); @@ -211,7 +211,7 @@ public class SearchActionTest { db.components().insertComponents(project, module, file1, file2, file3); setBrowsePermissionOnUserAndIndex(project); - SearchWsResponse response = call(new SearchWsRequest().setQualifiers(asList(PROJECT, MODULE, FILE))); + SearchWsResponse response = call(new SearchRequest().setQualifiers(asList(PROJECT, MODULE, FILE))); assertThat(response.getComponentsList()).extracting(Component::getKey, Component::getProject) .containsOnly(tuple(project.getDbKey(), project.getDbKey()), @@ -227,7 +227,7 @@ public class SearchActionTest { ComponentDto branch = db.components().insertProjectBranch(project); setBrowsePermissionOnUserAndIndex(project, branch); - SearchWsResponse response = call(new SearchWsRequest().setQualifiers(asList(PROJECT, MODULE, FILE))); + SearchWsResponse response = call(new SearchRequest().setQualifiers(asList(PROJECT, MODULE, FILE))); assertThat(response.getComponentsList()).extracting(Component::getKey) .containsOnly(project.getDbKey()); @@ -238,7 +238,7 @@ public class SearchActionTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Value of parameter 'qualifiers' (Unknown-Qualifier) must be one of: [BRC, DIR, FIL, TRK]"); - call(new SearchWsRequest().setQualifiers(singletonList("Unknown-Qualifier"))); + call(new SearchRequest().setQualifiers(singletonList("Unknown-Qualifier"))); } @Test @@ -246,7 +246,7 @@ public class SearchActionTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("The 'qualifiers' parameter is missing"); - call(new SearchWsRequest()); + call(new SearchRequest()); } @Test @@ -279,7 +279,7 @@ public class SearchActionTest { Arrays.stream(projects).forEach(project -> authorizationIndexerTester.allowOnlyUser(project, user)); } - private SearchWsResponse call(SearchWsRequest wsRequest) { + private SearchWsResponse call(SearchRequest wsRequest) { TestRequest request = ws.newRequest(); setNullable(wsRequest.getOrganization(), p -> request.setParam(PARAM_ORGANIZATION, p)); setNullable(wsRequest.getLanguage(), p -> request.setParam(PARAM_LANGUAGE, p)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryFactoryTest.java index e1f4cd234c3..9ac942c58b5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryFactoryTest.java @@ -35,7 +35,7 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.tester.UserSessionRule; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -70,7 +70,7 @@ public class IssueQueryFactoryTest { ComponentDto module = db.components().insertComponent(newModuleDto(project)); ComponentDto file = db.components().insertComponent(newFileDto(project)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setIssues(asList("anIssueKey")) .setSeverities(asList("MAJOR", "MINOR")) .setStatuses(asList("CLOSED")) @@ -117,7 +117,7 @@ public class IssueQueryFactoryTest { @Test public void dates_are_inclusive() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setCreatedAfter("2013-04-16") .setCreatedBefore("2013-04-17"); @@ -129,7 +129,7 @@ public class IssueQueryFactoryTest { @Test public void creation_date_support_localdate() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setCreatedAt("2013-04-16"); IssueQuery query = underTest.create(request); @@ -139,7 +139,7 @@ public class IssueQueryFactoryTest { @Test public void creation_date_support_zoneddatetime() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setCreatedAt("2013-04-16T09:08:24+0200"); IssueQuery query = underTest.create(request); @@ -149,7 +149,7 @@ public class IssueQueryFactoryTest { @Test public void add_unknown_when_no_component_found() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentKeys(asList("does_not_exist")); IssueQuery query = underTest.create(request); @@ -159,7 +159,7 @@ public class IssueQueryFactoryTest { @Test public void query_without_any_parameter() { - SearchWsRequest request = new SearchWsRequest(); + SearchRequest request = new SearchRequest(); IssueQuery query = underTest.create(request); @@ -185,7 +185,7 @@ public class IssueQueryFactoryTest { @Test public void fail_if_components_and_components_uuid_params_are_set_at_the_same_time() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentKeys(asList("foo")) .setComponentUuids(asList("bar")); @@ -197,7 +197,7 @@ public class IssueQueryFactoryTest { @Test public void fail_if_both_projects_and_projectUuids_params_are_set() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setProjectKeys(asList("foo")) .setProjectUuids(asList("bar")); @@ -209,7 +209,7 @@ public class IssueQueryFactoryTest { @Test public void fail_if_both_componentRoots_and_componentRootUuids_params_are_set() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentRoots(asList("foo")) .setComponentRootUuids(asList("bar")); @@ -223,7 +223,7 @@ public class IssueQueryFactoryTest { public void fail_if_componentRoots_references_components_with_different_qualifier() { ComponentDto project = db.components().insertPrivateProject(); ComponentDto file = db.components().insertComponent(newFileDto(project)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentRoots(asList(project.getDbKey(), file.getDbKey())); expectedException.expect(IllegalArgumentException.class); @@ -235,7 +235,7 @@ public class IssueQueryFactoryTest { @Test public void param_componentRootUuids_enables_search_in_view_tree_if_user_has_permission_on_view() { ComponentDto view = db.components().insertView(); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentRootUuids(asList(view.uuid())); userSession.registerComponents(view); @@ -254,7 +254,7 @@ public class IssueQueryFactoryTest { db.components().insertComponents(newProjectCopy("PC2", project2, application)); userSession.registerComponents(application, project1, project2); - IssueQuery result = underTest.create(new SearchWsRequest().setComponentUuids(singletonList(application.uuid()))); + IssueQuery result = underTest.create(new SearchRequest().setComponentUuids(singletonList(application.uuid()))); assertThat(result.viewUuids()).containsExactlyInAnyOrder(application.uuid()); } @@ -273,7 +273,7 @@ public class IssueQueryFactoryTest { db.components().insertComponents(newProjectCopy("PC3", project3, application)); userSession.registerComponents(application, project1, project2, project3); - IssueQuery result = underTest.create(new SearchWsRequest() + IssueQuery result = underTest.create(new SearchRequest() .setComponentUuids(singletonList(application.uuid())) .setSinceLeakPeriod(true)); @@ -286,7 +286,7 @@ public class IssueQueryFactoryTest { public void return_empty_results_if_not_allowed_to_search_for_subview() { ComponentDto view = db.components().insertView(); ComponentDto subView = db.components().insertComponent(newSubView(view)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentRootUuids(asList(subView.uuid())); IssueQuery query = underTest.create(request); @@ -297,7 +297,7 @@ public class IssueQueryFactoryTest { @Test public void param_componentUuids_enables_search_on_project_tree_by_default() { ComponentDto project = db.components().insertPrivateProject(); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentUuids(asList(project.uuid())); IssueQuery query = underTest.create(request); @@ -308,7 +308,7 @@ public class IssueQueryFactoryTest { @Test public void onComponentOnly_restricts_search_to_specified_componentKeys() { ComponentDto project = db.components().insertPrivateProject(); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentKeys(asList(project.getDbKey())) .setOnComponentOnly(true); @@ -323,7 +323,7 @@ public class IssueQueryFactoryTest { public void should_search_in_tree_with_module_uuid() { ComponentDto project = db.components().insertPrivateProject(); ComponentDto module = db.components().insertComponent(newModuleDto(project)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentUuids(asList(module.uuid())); IssueQuery query = underTest.create(request); @@ -335,7 +335,7 @@ public class IssueQueryFactoryTest { public void param_componentUuids_enables_search_in_directory_tree() { ComponentDto project = db.components().insertPrivateProject(); ComponentDto dir = db.components().insertComponent(newDirectory(project, "src/main/java/foo")); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentUuids(asList(dir.uuid())); IssueQuery query = underTest.create(request); @@ -349,7 +349,7 @@ public class IssueQueryFactoryTest { public void param_componentUuids_enables_search_by_file() { ComponentDto project = db.components().insertPrivateProject(); ComponentDto file = db.components().insertComponent(newFileDto(project)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentUuids(asList(file.uuid())); IssueQuery query = underTest.create(request); @@ -361,7 +361,7 @@ public class IssueQueryFactoryTest { public void param_componentUuids_enables_search_by_test_file() { ComponentDto project = db.components().insertPrivateProject(); ComponentDto file = db.components().insertComponent(newFileDto(project).setQualifier(Qualifiers.UNIT_TEST_FILE)); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setComponentUuids(asList(file.uuid())); IssueQuery query = underTest.create(request); @@ -374,13 +374,13 @@ public class IssueQueryFactoryTest { ComponentDto project = db.components().insertPrivateProject(); ComponentDto branch = db.components().insertProjectBranch(project); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setProjectKeys(singletonList(branch.getKey())) .setBranch(branch.getBranch()))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch) .containsOnly(branch.uuid(), singletonList(project.uuid()), false); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setComponentKeys(singletonList(branch.getKey())) .setBranch(branch.getBranch()))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch) @@ -393,20 +393,20 @@ public class IssueQueryFactoryTest { ComponentDto branch = db.components().insertProjectBranch(project); ComponentDto file = db.components().insertComponent(newFileDto(branch)); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setComponentKeys(singletonList(file.getKey())) .setBranch(branch.getBranch()))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch) .containsOnly(branch.uuid(), singletonList(file.uuid()), false); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setComponentKeys(singletonList(branch.getKey())) .setFileUuids(singletonList(file.uuid())) .setBranch(branch.getBranch()))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch) .containsOnly(branch.uuid(), singletonList(file.uuid()), false); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setProjectKeys(singletonList(branch.getKey())) .setFileUuids(singletonList(file.uuid())) .setBranch(branch.getBranch()))) @@ -420,7 +420,7 @@ public class IssueQueryFactoryTest { ComponentDto branch = db.components().insertProjectBranch(project); ComponentDto file = db.components().insertComponent(newFileDto(branch)); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setComponentKeys(singletonList(file.getKey())) .setBranch(branch.getBranch()) .setOnComponentOnly(true))) @@ -433,12 +433,12 @@ public class IssueQueryFactoryTest { ComponentDto project = db.components().insertMainBranch(); ComponentDto branch = db.components().insertProjectBranch(project); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setProjectKeys(singletonList(project.getKey())) .setBranch("master"))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch) .containsOnly(project.uuid(), singletonList(project.uuid()), true); - assertThat(underTest.create(new SearchWsRequest() + assertThat(underTest.create(new SearchRequest() .setComponentKeys(singletonList(project.getKey())) .setBranch("master"))) .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch) @@ -447,7 +447,7 @@ public class IssueQueryFactoryTest { @Test public void fail_if_created_after_and_created_since_are_both_set() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setCreatedAfter("2013-07-25T07:35:00+0100") .setCreatedInLast("palap"); @@ -464,7 +464,7 @@ public class IssueQueryFactoryTest { Date now = DateUtils.parseDateTime("2013-07-25T07:35:00+0100"); when(clock.instant()).thenReturn(now.toInstant()); when(clock.getZone()).thenReturn(ZoneOffset.UTC); - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setCreatedInLast("1y2m3w4d"); assertThat(underTest.create(request).createdAfter()).isEqualTo(DateUtils.parseDateTime("2012-04-30T07:35:00+0100")); } @@ -474,7 +474,7 @@ public class IssueQueryFactoryTest { expectedException.expect(BadRequestException.class); expectedException.expectMessage("Parameters 'createdAfter' and 'sinceLeakPeriod' cannot be set simultaneously"); - underTest.create(new SearchWsRequest() + underTest.create(new SearchRequest() .setSinceLeakPeriod(true) .setCreatedAfter("2013-07-25T07:35:00+0100")); } @@ -484,7 +484,7 @@ public class IssueQueryFactoryTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("One and only one component must be provided when searching since leak period"); - underTest.create(new SearchWsRequest().setSinceLeakPeriod(true)); + underTest.create(new SearchRequest().setSinceLeakPeriod(true)); } @Test @@ -495,7 +495,7 @@ public class IssueQueryFactoryTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("One and only one component must be provided when searching since leak period"); - underTest.create(new SearchWsRequest() + underTest.create(new SearchRequest() .setSinceLeakPeriod(true) .setComponentKeys(asList(project1.getKey(), project2.getKey()))); } @@ -505,13 +505,13 @@ public class IssueQueryFactoryTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("'unknown-date' cannot be parsed as either a date or date+time"); - underTest.create(new SearchWsRequest() + underTest.create(new SearchRequest() .setCreatedAfter("unknown-date")); } @Test public void return_empty_results_if_organization_with_specified_key_does_not_exist() { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setOrganization("does_not_exist"); IssueQuery query = underTest.create(request); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java index b157ea73f71..b020c4426fc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java @@ -31,7 +31,7 @@ import org.sonar.server.issue.IssueQueryFactory; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; @@ -89,7 +89,7 @@ public class ComponentTagsActionTest { .put("bug", 32L) .put("cert", 2L) .build(); - ArgumentCaptor captor = ArgumentCaptor.forClass(SearchWsRequest.class); + ArgumentCaptor captor = ArgumentCaptor.forClass(SearchRequest.class); when(issueQueryFactory.create(captor.capture())).thenReturn(mock(IssueQuery.class)); when(service.countTags(any(IssueQuery.class), eq(5))).thenReturn(tags); @@ -113,7 +113,7 @@ public class ComponentTagsActionTest { .put("bug", 32L) .put("cert", 2L) .build(); - ArgumentCaptor captor = ArgumentCaptor.forClass(SearchWsRequest.class); + ArgumentCaptor captor = ArgumentCaptor.forClass(SearchRequest.class); when(issueQueryFactory.create(captor.capture())).thenReturn(mock(IssueQuery.class)); when(service.countTags(any(IssueQuery.class), eq(5))).thenReturn(tags); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java index a829d11a989..379f7747237 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java @@ -32,7 +32,7 @@ import org.sonar.core.util.Uuids; import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; import static com.google.common.collect.Lists.newArrayList; import static java.util.Collections.singletonList; @@ -88,7 +88,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_names() { - ComponentTreeWsRequest wsRequest = newRequest(singletonList(NAME_SORT), true, null); + ComponentTreeRequest wsRequest = newRequest(singletonList(NAME_SORT), true, null); List result = sortComponents(wsRequest); assertThat(result).extracting("name") @@ -97,7 +97,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_qualifier() { - ComponentTreeWsRequest wsRequest = newRequest(singletonList(QUALIFIER_SORT), false, null); + ComponentTreeRequest wsRequest = newRequest(singletonList(QUALIFIER_SORT), false, null); List result = sortComponents(wsRequest); @@ -107,7 +107,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_path() { - ComponentTreeWsRequest wsRequest = newRequest(singletonList(PATH_SORT), true, null); + ComponentTreeRequest wsRequest = newRequest(singletonList(PATH_SORT), true, null); List result = sortComponents(wsRequest); @@ -118,7 +118,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_numerical_metric_key_ascending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, NUM_METRIC_KEY); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, NUM_METRIC_KEY); List result = sortComponents(wsRequest); @@ -129,7 +129,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_numerical_metric_key_descending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY); List result = sortComponents(wsRequest); @@ -144,7 +144,7 @@ public class ComponentTreeSortTest { newComponentWithoutSnapshotId("PROJECT 11", Qualifiers.PROJECT, "PROJECT_PATH_1"), newComponentWithoutSnapshotId("PROJECT 0", Qualifiers.PROJECT, "PROJECT_PATH_2")); - ComponentTreeWsRequest wsRequest = newRequest(newArrayList(PATH_SORT), false, null); + ComponentTreeRequest wsRequest = newRequest(newArrayList(PATH_SORT), false, null); List result = sortComponents(wsRequest); @@ -170,7 +170,7 @@ public class ComponentTreeSortTest { String alertStatus = statuses.get(i % 3); measuresByComponentUuidAndMetric.put(component.uuid(), metrics.get(0), createFromMeasureDto(new MeasureDto().setData(alertStatus))); } - ComponentTreeWsRequest wsRequest = newRequest(newArrayList(METRIC_SORT, NAME_SORT), true, CoreMetrics.ALERT_STATUS_KEY); + ComponentTreeRequest wsRequest = newRequest(newArrayList(METRIC_SORT, NAME_SORT), true, CoreMetrics.ALERT_STATUS_KEY); List result = sortComponents(wsRequest); @@ -183,7 +183,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_numerical_metric_period_1_key_ascending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), true, NUM_METRIC_KEY).setMetricPeriodSort(1); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), true, NUM_METRIC_KEY).setMetricPeriodSort(1); List result = sortComponents(wsRequest); @@ -194,7 +194,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_numerical_metric_period_1_key_descending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(1); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(1); List result = sortComponents(wsRequest); @@ -205,7 +205,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_numerical_metric_period_5_key() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(5); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(5); List result = sortComponents(wsRequest); @@ -216,7 +216,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_textual_metric_key_ascending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, TEXT_METRIC_KEY); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, TEXT_METRIC_KEY); List result = sortComponents(wsRequest); @@ -227,7 +227,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_textual_metric_key_descending() { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); - ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, TEXT_METRIC_KEY); + ComponentTreeRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, TEXT_METRIC_KEY); List result = sortComponents(wsRequest); @@ -241,7 +241,7 @@ public class ComponentTreeSortTest { newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-2"), newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-3"), newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-1")); - ComponentTreeWsRequest wsRequest = newRequest(newArrayList(NAME_SORT, QUALIFIER_SORT, PATH_SORT), true, null); + ComponentTreeRequest wsRequest = newRequest(newArrayList(NAME_SORT, QUALIFIER_SORT, PATH_SORT), true, null); List result = sortComponents(wsRequest); @@ -249,7 +249,7 @@ public class ComponentTreeSortTest { .containsExactly("path-1", "path-2", "path-3"); } - private List sortComponents(ComponentTreeWsRequest wsRequest) { + private List sortComponents(ComponentTreeRequest wsRequest) { return ComponentTreeSort.sortComponents(components, wsRequest, metrics, measuresByComponentUuidAndMetric); } @@ -261,8 +261,8 @@ public class ComponentTreeSortTest { .setPath(path); } - private static ComponentTreeWsRequest newRequest(List sortFields, boolean isAscending, @Nullable String metricKey) { - return new ComponentTreeWsRequest() + private static ComponentTreeRequest newRequest(List sortFields, boolean isAscending, @Nullable String metricKey) { + return new ComponentTreeRequest() .setAsc(isAscending) .setSort(sortFields) .setMetricSort(metricKey); diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/SearchMembersActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/SearchMembersActionTest.java index 4b9608912d7..695869c6d48 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/SearchMembersActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/SearchMembersActionTest.java @@ -48,7 +48,7 @@ import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Common.Paging; import org.sonarqube.ws.Organizations.SearchMembersWsResponse; import org.sonarqube.ws.Organizations.User; -import org.sonarqube.ws.client.organization.SearchMembersWsRequest; +import org.sonarqube.ws.client.organization.SearchMembersRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; @@ -73,7 +73,7 @@ public class SearchMembersActionTest { private WsActionTester ws = new WsActionTester(new SearchMembersAction(dbClient, new UserIndex(es.client(), System2.INSTANCE), organizationProvider, userSession, new AvatarResolverImpl())); - private SearchMembersWsRequest request = new SearchMembersWsRequest(); + private SearchMembersRequest request = new SearchMembersRequest(); @Test public void empty_response() { 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 b4f670a9bfa..0c74c2cca21 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 @@ -48,7 +48,7 @@ import org.sonarqube.ws.MediaTypes; 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; +import org.sonarqube.ws.client.project.SearchRequest; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -104,7 +104,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("PROJECT-_%-KEY"), ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-key-without-escaped-characters")); - SearchWsResponse response = call(SearchWsRequest.builder().setQuery("JeCt-_%-k").build()); + SearchWsResponse response = call(SearchRequest.builder().setQuery("JeCt-_%-k").build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("project-_%-key", "PROJECT-_%-KEY"); } @@ -116,7 +116,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("private-key"), ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setDbKey("public-key")); - SearchWsResponse response = call(SearchWsRequest.builder().setVisibility("private").build()); + SearchWsResponse response = call(SearchRequest.builder().setVisibility("private").build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("private-key"); } @@ -128,7 +128,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("private-key"), ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setDbKey("public-key")); - SearchWsResponse response = call(SearchWsRequest.builder().setVisibility("public").build()); + SearchWsResponse response = call(SearchRequest.builder().setVisibility("public").build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("public-key"); } @@ -140,7 +140,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1), newView(db.getDefaultOrganization())); - SearchWsResponse response = call(SearchWsRequest.builder().build()); + SearchWsResponse response = call(SearchRequest.builder().build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(PROJECT_KEY_1); } @@ -157,7 +157,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_2), newView(db.getDefaultOrganization())); - SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(singletonList("TRK")).build()); + SearchWsResponse response = call(SearchRequest.builder().setQualifiers(singletonList("TRK")).build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(PROJECT_KEY_1, PROJECT_KEY_2); } @@ -169,7 +169,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1), newView(db.getDefaultOrganization()).setDbKey("view1")); - SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(singletonList("VW")).build()); + SearchWsResponse response = call(SearchRequest.builder().setQualifiers(singletonList("VW")).build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly("view1"); } @@ -181,7 +181,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1), newView(db.getDefaultOrganization()).setDbKey("view1")); - SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(asList("TRK", "VW")).build()); + SearchWsResponse response = call(SearchRequest.builder().setQualifiers(asList("TRK", "VW")).build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(PROJECT_KEY_1, "view1"); } @@ -195,7 +195,7 @@ public class SearchActionTest { ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_2), ComponentTesting.newPrivateProjectDto(otherOrganization).setDbKey(PROJECT_KEY_3)); - SearchWsResponse response = call(SearchWsRequest.builder().build()); + SearchWsResponse response = call(SearchRequest.builder().build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(PROJECT_KEY_1, PROJECT_KEY_2); } @@ -210,7 +210,7 @@ public class SearchActionTest { ComponentDto project3 = ComponentTesting.newPrivateProjectDto(organization2); db.components().insertComponents(project1, project2, project3); - SearchWsResponse response = call(SearchWsRequest.builder().setOrganization(organization1.getKey()).build()); + SearchWsResponse response = call(SearchRequest.builder().setOrganization(organization1.getKey()).build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(project1.getDbKey(), project2.getDbKey()); } @@ -226,7 +226,7 @@ public class SearchActionTest { db.getDbClient().snapshotDao().insert(db.getSession(), newAnalysis(recentProject).setCreatedAt(recentTime)); db.commit(); - SearchWsResponse result = call(SearchWsRequest.builder().setAnalyzedBefore(formatDate(new Date(recentTime))).build()); + SearchWsResponse result = call(SearchRequest.builder().setAnalyzedBefore(formatDate(new Date(recentTime))).build()); assertThat(result.getComponentsList()).extracting(Component::getKey) .containsExactlyInAnyOrder(oldProject.getKey()) @@ -239,7 +239,7 @@ public class SearchActionTest { ComponentDto branch = db.components().insertProjectBranch(project); userSession.addPermission(ADMINISTER, db.getDefaultOrganization()); - SearchWsResponse response = call(SearchWsRequest.builder().build()); + SearchWsResponse response = call(SearchRequest.builder().build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(project.getDbKey()); } @@ -253,7 +253,7 @@ public class SearchActionTest { } db.components().insertComponents(componentDtoList.toArray(new ComponentDto[] {})); - SearchWsResponse response = call(SearchWsRequest.builder().setPage(2).setPageSize(3).build()); + SearchWsResponse response = call(SearchRequest.builder().setPage(2).setPageSize(3).build()); assertThat(response.getComponentsList()).extracting(Component::getKey).containsExactly("project-key-4", "project-key-5", "project-key-6"); } @@ -265,7 +265,7 @@ public class SearchActionTest { ComponentDto analyzedProject = db.components().insertPrivateProject(); db.components().insertSnapshot(newAnalysis(analyzedProject)); - SearchWsResponse response = call(SearchWsRequest.builder().setOnProvisionedOnly(true).build()); + SearchWsResponse response = call(SearchRequest.builder().setOnProvisionedOnly(true).build()); assertThat(response.getComponentsList()).extracting(Component::getKey) .containsExactlyInAnyOrder(provisionedProject.getKey()) @@ -279,7 +279,7 @@ public class SearchActionTest { ComponentDto sonarqube = db.components().insertPrivateProject(); ComponentDto sonarlint = db.components().insertPrivateProject(); - SearchWsResponse result = call(SearchWsRequest.builder() + SearchWsResponse result = call(SearchRequest.builder() .setProjects(Arrays.asList(jdk.getKey(), sonarqube.getKey())) .build()); @@ -295,7 +295,7 @@ public class SearchActionTest { ComponentDto sonarqube = db.components().insertPrivateProject(); ComponentDto sonarlint = db.components().insertPrivateProject(); - SearchWsResponse result = call(SearchWsRequest.builder() + SearchWsResponse result = call(SearchRequest.builder() .setProjectIds(Arrays.asList(jdk.uuid(), sonarqube.uuid())) .build()); @@ -309,14 +309,14 @@ public class SearchActionTest { userSession.addPermission(ADMINISTER_QUALITY_PROFILES, db.getDefaultOrganization()); expectedException.expect(ForbiddenException.class); - call(SearchWsRequest.builder().build()); + call(SearchRequest.builder().build()); } @Test public void fail_on_unknown_organization() throws Exception { expectedException.expect(NotFoundException.class); - call(SearchWsRequest.builder().setOrganization("unknown").build()); + call(SearchRequest.builder().setOrganization("unknown").build()); } @Test @@ -325,7 +325,7 @@ public class SearchActionTest { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Value of parameter 'qualifiers' (BRC) must be one of: [TRK, VW, APP]"); - call(SearchWsRequest.builder().setQualifiers(singletonList("BRC")).build()); + call(SearchRequest.builder().setQualifiers(singletonList("BRC")).build()); } @Test @@ -408,7 +408,7 @@ public class SearchActionTest { assertJson(ws.getDef().responseExampleAsString()).isSimilarTo(response); } - private SearchWsResponse call(SearchWsRequest wsRequest) { + private SearchWsResponse call(SearchRequest wsRequest) { TestRequest request = ws.newRequest(); setNullable(wsRequest.getOrganization(), organization -> request.setParam(PARAM_ORGANIZATION, organization)); List qualifiers = wsRequest.getQualifiers(); 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 6d45e829bf2..163b1fdb3e7 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 @@ -52,7 +52,7 @@ public class ComponentsService extends BaseService { super(wsConnector, CONTROLLER_COMPONENTS); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { GetRequest get = new GetRequest(path(ACTION_SEARCH)) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(request.getQualifiers())) @@ -62,7 +62,7 @@ public class ComponentsService extends BaseService { return call(get, SearchWsResponse.parser()); } - public TreeWsResponse tree(TreeWsRequest request) { + public TreeWsResponse tree(TreeRequest request) { GetRequest get = new GetRequest(path(ACTION_TREE)) .setParam(PARAM_COMPONENT_ID, request.getBaseComponentId()) .setParam("baseComponentKey", request.getBaseComponentKey()) @@ -77,7 +77,7 @@ public class ComponentsService extends BaseService { return call(get, TreeWsResponse.parser()); } - public ShowWsResponse show(ShowWsRequest request) { + public ShowWsResponse show(ShowRequest request) { GetRequest get = new GetRequest(path(ACTION_SHOW)) .setParam(PARAM_COMPONENT_ID, request.getId()) .setParam(PARAM_COMPONENT, request.getKey()) @@ -100,7 +100,7 @@ public class ComponentsService extends BaseService { return call(get, SearchProjectsWsResponse.parser()); } - public WsResponse suggestions(SuggestionsWsRequest request) { + public WsResponse suggestions(SuggestionsRequest request) { GetRequest get = new GetRequest(path(ACTION_SUGGESTIONS)) .setParam("more", request.getMore() == null ? null : request.getMore().toString()) .setParam("recentlyBrowsed", request.getRecentlyBrowsed().stream().collect(Collectors.joining(","))) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.java new file mode 100644 index 00000000000..efe91f239d8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.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.component; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class SearchRequest { + private String organization; + private List qualifiers; + private Integer page; + private Integer pageSize; + private String query; + private String language; + + @CheckForNull + public String getOrganization() { + return organization; + } + + public SearchRequest setOrganization(@Nullable String organization) { + this.organization = organization; + return this; + } + + public List getQualifiers() { + return qualifiers; + } + + public SearchRequest setQualifiers(List qualifiers) { + this.qualifiers = requireNonNull(qualifiers); + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public SearchRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public SearchRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public String getLanguage() { + return language; + } + + public SearchRequest setLanguage(@Nullable String language) { + this.language = language; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchWsRequest.java deleted file mode 100644 index 7d7dcc05323..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchWsRequest.java +++ /dev/null @@ -1,94 +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.component; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class SearchWsRequest { - private String organization; - private List qualifiers; - private Integer page; - private Integer pageSize; - private String query; - private String language; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public SearchWsRequest setOrganization(@Nullable String organization) { - this.organization = organization; - return this; - } - - public List getQualifiers() { - return qualifiers; - } - - public SearchWsRequest setQualifiers(List qualifiers) { - this.qualifiers = requireNonNull(qualifiers); - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public String getLanguage() { - return language; - } - - public SearchWsRequest setLanguage(@Nullable String language) { - this.language = language; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java new file mode 100644 index 00000000000..2377e7dfea3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java @@ -0,0 +1,59 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.component; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ShowRequest { + private String id; + private String key; + private String branch; + + @CheckForNull + public String getId() { + return id; + } + + public ShowRequest setId(@Nullable String id) { + this.id = id; + return this; + } + + @CheckForNull + public String getKey() { + return key; + } + + public ShowRequest setKey(@Nullable String key) { + this.key = key; + return this; + } + + @CheckForNull + public String getBranch() { + return branch; + } + + public ShowRequest setBranch(@Nullable String branch) { + this.branch = branch; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowWsRequest.java deleted file mode 100644 index 1ada1585b8d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowWsRequest.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.component; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ShowWsRequest { - private String id; - private String key; - private String branch; - - @CheckForNull - public String getId() { - return id; - } - - public ShowWsRequest setId(@Nullable String id) { - this.id = id; - return this; - } - - @CheckForNull - public String getKey() { - return key; - } - - public ShowWsRequest setKey(@Nullable String key) { - this.key = key; - return this; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public ShowWsRequest setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java new file mode 100644 index 00000000000..1f28b21db1b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java @@ -0,0 +1,95 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.component; + +import java.util.Collections; +import java.util.List; + +public class SuggestionsRequest { + + public static final int MAX_PAGE_SIZE = 500; + public static final int DEFAULT_PAGE_SIZE = 100; + + public enum More { + VW, + SVW, + APP, + TRK, + BRC, + FIL, + UTS + } + + private final More more; + private final List recentlyBrowsed; + private final String s; + + private SuggestionsRequest(Builder builder) { + this.more = builder.more; + this.recentlyBrowsed = builder.recentlyBrowsed; + this.s = builder.s; + } + + public More getMore() { + return more; + } + + public List getRecentlyBrowsed() { + return recentlyBrowsed; + } + + public String getS() { + return s; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private More more; + private List recentlyBrowsed = Collections.emptyList(); + private String s; + + private Builder() { + // enforce static factory method + } + + public Builder setMore(More more) { + this.more = more; + return this; + } + + public Builder setRecentlyBrowsed(List recentlyBrowsed) { + this.recentlyBrowsed = recentlyBrowsed; + return this; + } + + public Builder setS(String s) { + this.s = s; + return this; + } + + public SuggestionsRequest build() { + return new SuggestionsRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsWsRequest.java deleted file mode 100644 index ca7fd84d11c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsWsRequest.java +++ /dev/null @@ -1,95 +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.component; - -import java.util.Collections; -import java.util.List; - -public class SuggestionsWsRequest { - - public static final int MAX_PAGE_SIZE = 500; - public static final int DEFAULT_PAGE_SIZE = 100; - - public enum More { - VW, - SVW, - APP, - TRK, - BRC, - FIL, - UTS - } - - private final More more; - private final List recentlyBrowsed; - private final String s; - - private SuggestionsWsRequest(Builder builder) { - this.more = builder.more; - this.recentlyBrowsed = builder.recentlyBrowsed; - this.s = builder.s; - } - - public More getMore() { - return more; - } - - public List getRecentlyBrowsed() { - return recentlyBrowsed; - } - - public String getS() { - return s; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - - private More more; - private List recentlyBrowsed = Collections.emptyList(); - private String s; - - private Builder() { - // enforce static factory method - } - - public Builder setMore(More more) { - this.more = more; - return this; - } - - public Builder setRecentlyBrowsed(List recentlyBrowsed) { - this.recentlyBrowsed = recentlyBrowsed; - return this; - } - - public Builder setS(String s) { - this.s = s; - return this; - } - - public SuggestionsWsRequest build() { - return new SuggestionsWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.java new file mode 100644 index 00000000000..569e44ad686 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.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.component; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class TreeRequest { + private String baseComponentId; + private String baseComponentKey; + private String component; + private String branch; + private String strategy; + private List qualifiers; + private String query; + private List sort; + private Boolean asc; + private Integer page; + private Integer pageSize; + + /** + * @deprecated since 6.4, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getBaseComponentId() { + return baseComponentId; + } + + /** + * @deprecated since 6.4, please use {@link #setComponent(String)} instead + */ + @Deprecated + public TreeRequest setBaseComponentId(@Nullable String baseComponentId) { + this.baseComponentId = baseComponentId; + return this; + } + + /** + * @deprecated since 6.4, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getBaseComponentKey() { + return baseComponentKey; + } + + /** + * @deprecated since 6.4, please use {@link #setComponent(String)} instead + */ + @Deprecated + public TreeRequest setBaseComponentKey(@Nullable String baseComponentKey) { + this.baseComponentKey = baseComponentKey; + return this; + } + + public TreeRequest setComponent(@Nullable String component) { + this.component = component; + return this; + } + + @CheckForNull + public String getComponent() { + return component; + } + + @CheckForNull + public String getBranch() { + return branch; + } + + public TreeRequest setBranch(@Nullable String branch) { + this.branch = branch; + return this; + } + + @CheckForNull + public String getStrategy() { + return strategy; + } + + public TreeRequest setStrategy(@Nullable String strategy) { + this.strategy = strategy; + return this; + } + + @CheckForNull + public List getQualifiers() { + return qualifiers; + } + + public TreeRequest setQualifiers(@Nullable List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public TreeRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public List getSort() { + return sort; + } + + public TreeRequest setSort(@Nullable List sort) { + this.sort = sort; + return this; + } + + public Boolean getAsc() { + return asc; + } + + public TreeRequest setAsc(@Nullable Boolean asc) { + this.asc = asc; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public TreeRequest setPage(@Nullable Integer page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public TreeRequest setPageSize(@Nullable Integer pageSize) { + this.pageSize = pageSize; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java deleted file mode 100644 index d941300974c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java +++ /dev/null @@ -1,163 +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.component; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class TreeWsRequest { - private String baseComponentId; - private String baseComponentKey; - private String component; - private String branch; - private String strategy; - private List qualifiers; - private String query; - private List sort; - private Boolean asc; - private Integer page; - private Integer pageSize; - - /** - * @deprecated since 6.4, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getBaseComponentId() { - return baseComponentId; - } - - /** - * @deprecated since 6.4, please use {@link #setComponent(String)} instead - */ - @Deprecated - public TreeWsRequest setBaseComponentId(@Nullable String baseComponentId) { - this.baseComponentId = baseComponentId; - return this; - } - - /** - * @deprecated since 6.4, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getBaseComponentKey() { - return baseComponentKey; - } - - /** - * @deprecated since 6.4, please use {@link #setComponent(String)} instead - */ - @Deprecated - public TreeWsRequest setBaseComponentKey(@Nullable String baseComponentKey) { - this.baseComponentKey = baseComponentKey; - return this; - } - - public TreeWsRequest setComponent(@Nullable String component) { - this.component = component; - return this; - } - - @CheckForNull - public String getComponent() { - return component; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public TreeWsRequest setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - @CheckForNull - public String getStrategy() { - return strategy; - } - - public TreeWsRequest setStrategy(@Nullable String strategy) { - this.strategy = strategy; - return this; - } - - @CheckForNull - public List getQualifiers() { - return qualifiers; - } - - public TreeWsRequest setQualifiers(@Nullable List qualifiers) { - this.qualifiers = qualifiers; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public TreeWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public List getSort() { - return sort; - } - - public TreeWsRequest setSort(@Nullable List sort) { - this.sort = sort; - return this; - } - - public Boolean getAsc() { - return asc; - } - - public TreeWsRequest setAsc(@Nullable Boolean asc) { - this.asc = asc; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public TreeWsRequest setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public TreeWsRequest setPageSize(@Nullable Integer pageSize) { - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesService.java index fb9c73feae7..58e94c13e2e 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesService.java @@ -158,7 +158,7 @@ public class IssuesService extends BaseService { Issues.Operation.parser()); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { return call( new GetRequest(path(ACTION_SEARCH)) .setParam(DEPRECATED_PARAM_ACTION_PLANS, inlineMultipleParamValue(request.getActionPlans())) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchRequest.java new file mode 100644 index 00000000000..841e00791da --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchRequest.java @@ -0,0 +1,456 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.issue; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchRequest { + private List actionPlans; + private List additionalFields; + private Boolean asc; + private Boolean assigned; + private List assignees; + private List authors; + private List componentKeys; + private List componentRootUuids; + private List componentRoots; + private List componentUuids; + private List 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 Boolean onComponentOnly; + private String branch; + private String organization; + private Integer page; + private Integer pageSize; + private List projectKeys; + private List projectUuids; + private List projects; + private List resolutions; + private Boolean resolved; + private List rules; + private Boolean sinceLeakPeriod; + private String sort; + private List severities; + private List statuses; + private List tags; + private List types; + + @CheckForNull + public List getActionPlans() { + return actionPlans; + } + + public SearchRequest setActionPlans(@Nullable List actionPlans) { + this.actionPlans = actionPlans; + return this; + } + + @CheckForNull + public List getAdditionalFields() { + return additionalFields; + } + + public SearchRequest setAdditionalFields(@Nullable List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + @CheckForNull + public Boolean getAsc() { + return asc; + } + + public SearchRequest setAsc(boolean asc) { + this.asc = asc; + return this; + } + + @CheckForNull + public Boolean getAssigned() { + return assigned; + } + + public SearchRequest setAssigned(@Nullable Boolean assigned) { + this.assigned = assigned; + return this; + } + + @CheckForNull + public List getAssignees() { + return assignees; + } + + public SearchRequest setAssignees(@Nullable List assignees) { + this.assignees = assignees; + return this; + } + + @CheckForNull + public List getAuthors() { + return authors; + } + + public SearchRequest setAuthors(@Nullable List authors) { + this.authors = authors; + return this; + } + + @CheckForNull + public List getComponentKeys() { + return componentKeys; + } + + public SearchRequest setComponentKeys(@Nullable List componentKeys) { + this.componentKeys = componentKeys; + return this; + } + + @CheckForNull + public List getComponentUuids() { + return componentUuids; + } + + public SearchRequest setComponentUuids(@Nullable List componentUuids) { + this.componentUuids = componentUuids; + return this; + } + + @CheckForNull + public String getCreatedAfter() { + return createdAfter; + } + + public SearchRequest setCreatedAfter(@Nullable String createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + @CheckForNull + public String getCreatedAt() { + return createdAt; + } + + public SearchRequest setCreatedAt(@Nullable String createdAt) { + this.createdAt = createdAt; + return this; + } + + @CheckForNull + public String getCreatedBefore() { + return createdBefore; + } + + public SearchRequest setCreatedBefore(@Nullable String createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + @CheckForNull + public String getCreatedInLast() { + return createdInLast; + } + + public SearchRequest setCreatedInLast(@Nullable String createdInLast) { + this.createdInLast = createdInLast; + return this; + } + + @CheckForNull + public List getDirectories() { + return directories; + } + + public SearchRequest setDirectories(@Nullable List directories) { + this.directories = directories; + return this; + } + + @CheckForNull + public String getFacetMode() { + return facetMode; + } + + public SearchRequest setFacetMode(@Nullable String facetMode) { + this.facetMode = facetMode; + return this; + } + + @CheckForNull + public List getFacets() { + return facets; + } + + public SearchRequest setFacets(@Nullable List facets) { + this.facets = facets; + return this; + } + + @CheckForNull + public List getFileUuids() { + return fileUuids; + } + + public SearchRequest setFileUuids(@Nullable List fileUuids) { + this.fileUuids = fileUuids; + return this; + } + + @CheckForNull + public List getIssues() { + return issues; + } + + public SearchRequest setIssues(@Nullable List issues) { + this.issues = issues; + return this; + } + + @CheckForNull + public List getLanguages() { + return languages; + } + + public SearchRequest setLanguages(@Nullable List languages) { + this.languages = languages; + return this; + } + + @CheckForNull + public List getModuleUuids() { + return moduleUuids; + } + + public SearchRequest setModuleUuids(@Nullable List moduleUuids) { + this.moduleUuids = moduleUuids; + return this; + } + + @CheckForNull + public Boolean getOnComponentOnly() { + return onComponentOnly; + } + + public SearchRequest setOnComponentOnly(Boolean onComponentOnly) { + this.onComponentOnly = onComponentOnly; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public SearchRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public SearchRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public SearchRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public List getProjectKeys() { + return projectKeys; + } + + public SearchRequest setProjectKeys(@Nullable List projectKeys) { + this.projectKeys = projectKeys; + return this; + } + + @CheckForNull + public List getProjectUuids() { + return projectUuids; + } + + public SearchRequest setProjectUuids(@Nullable List projectUuids) { + this.projectUuids = projectUuids; + return this; + } + + @CheckForNull + public List getResolutions() { + return resolutions; + } + + public SearchRequest setResolutions(@Nullable List resolutions) { + this.resolutions = resolutions; + return this; + } + + @CheckForNull + public Boolean getResolved() { + return resolved; + } + + public SearchRequest setResolved(@Nullable Boolean resolved) { + this.resolved = resolved; + return this; + } + + @CheckForNull + public List getRules() { + return rules; + } + + public SearchRequest setRules(@Nullable List rules) { + this.rules = rules; + return this; + } + + @CheckForNull + public Boolean getSinceLeakPeriod() { + return sinceLeakPeriod; + } + + public SearchRequest setSinceLeakPeriod(@Nullable Boolean sinceLeakPeriod) { + this.sinceLeakPeriod = sinceLeakPeriod; + return this; + } + + @CheckForNull + public String getSort() { + return sort; + } + + public SearchRequest setSort(@Nullable String sort) { + this.sort = sort; + return this; + } + + @CheckForNull + public List getSeverities() { + return severities; + } + + public SearchRequest setSeverities(@Nullable List severities) { + this.severities = severities; + return this; + } + + @CheckForNull + public List getStatuses() { + return statuses; + } + + public SearchRequest setStatuses(@Nullable List statuses) { + this.statuses = statuses; + return this; + } + + @CheckForNull + public List getTags() { + return tags; + } + + public SearchRequest setTags(@Nullable List tags) { + this.tags = tags; + return this; + } + + @CheckForNull + public List getTypes() { + return types; + } + + public SearchRequest setTypes(@Nullable List types) { + this.types = types; + return this; + } + + @CheckForNull + public List getComponentRootUuids() { + return componentRootUuids; + } + + public SearchRequest setComponentRootUuids(List componentRootUuids) { + this.componentRootUuids = componentRootUuids; + return this; + } + + @CheckForNull + public List getComponentRoots() { + return componentRoots; + } + + public SearchRequest setComponentRoots(@Nullable List componentRoots) { + this.componentRoots = componentRoots; + return this; + } + + @CheckForNull + public List getComponents() { + return components; + } + + public SearchRequest setComponents(@Nullable List components) { + this.components = components; + return this; + } + + @CheckForNull + public List getProjects() { + return projects; + } + + public SearchRequest setProjects(@Nullable List projects) { + this.projects = projects; + return this; + } + + @CheckForNull + public String getBranch() { + return branch; + } + + public SearchRequest setBranch(@Nullable String branch) { + this.branch = branch; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchWsRequest.java deleted file mode 100644 index 427ea7f5845..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/SearchWsRequest.java +++ /dev/null @@ -1,456 +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.issue; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchWsRequest { - private List actionPlans; - private List additionalFields; - private Boolean asc; - private Boolean assigned; - private List assignees; - private List authors; - private List componentKeys; - private List componentRootUuids; - private List componentRoots; - private List componentUuids; - private List 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 Boolean onComponentOnly; - private String branch; - private String organization; - private Integer page; - private Integer pageSize; - private List projectKeys; - private List projectUuids; - private List projects; - private List resolutions; - private Boolean resolved; - private List rules; - private Boolean sinceLeakPeriod; - private String sort; - private List severities; - private List statuses; - private List tags; - private List types; - - @CheckForNull - public List getActionPlans() { - return actionPlans; - } - - public SearchWsRequest setActionPlans(@Nullable List actionPlans) { - this.actionPlans = actionPlans; - return this; - } - - @CheckForNull - public List getAdditionalFields() { - return additionalFields; - } - - public SearchWsRequest setAdditionalFields(@Nullable List additionalFields) { - this.additionalFields = additionalFields; - return this; - } - - @CheckForNull - public Boolean getAsc() { - return asc; - } - - public SearchWsRequest setAsc(boolean asc) { - this.asc = asc; - return this; - } - - @CheckForNull - public Boolean getAssigned() { - return assigned; - } - - public SearchWsRequest setAssigned(@Nullable Boolean assigned) { - this.assigned = assigned; - return this; - } - - @CheckForNull - public List getAssignees() { - return assignees; - } - - public SearchWsRequest setAssignees(@Nullable List assignees) { - this.assignees = assignees; - return this; - } - - @CheckForNull - public List getAuthors() { - return authors; - } - - public SearchWsRequest setAuthors(@Nullable List authors) { - this.authors = authors; - return this; - } - - @CheckForNull - public List getComponentKeys() { - return componentKeys; - } - - public SearchWsRequest setComponentKeys(@Nullable List componentKeys) { - this.componentKeys = componentKeys; - return this; - } - - @CheckForNull - public List getComponentUuids() { - return componentUuids; - } - - public SearchWsRequest setComponentUuids(@Nullable List componentUuids) { - this.componentUuids = componentUuids; - return this; - } - - @CheckForNull - public String getCreatedAfter() { - return createdAfter; - } - - public SearchWsRequest setCreatedAfter(@Nullable String createdAfter) { - this.createdAfter = createdAfter; - return this; - } - - @CheckForNull - public String getCreatedAt() { - return createdAt; - } - - public SearchWsRequest setCreatedAt(@Nullable String createdAt) { - this.createdAt = createdAt; - return this; - } - - @CheckForNull - public String getCreatedBefore() { - return createdBefore; - } - - public SearchWsRequest setCreatedBefore(@Nullable String createdBefore) { - this.createdBefore = createdBefore; - return this; - } - - @CheckForNull - public String getCreatedInLast() { - return createdInLast; - } - - public SearchWsRequest setCreatedInLast(@Nullable String createdInLast) { - this.createdInLast = createdInLast; - return this; - } - - @CheckForNull - public List getDirectories() { - return directories; - } - - public SearchWsRequest setDirectories(@Nullable List directories) { - this.directories = directories; - return this; - } - - @CheckForNull - public String getFacetMode() { - return facetMode; - } - - public SearchWsRequest setFacetMode(@Nullable String facetMode) { - this.facetMode = facetMode; - return this; - } - - @CheckForNull - public List getFacets() { - return facets; - } - - public SearchWsRequest setFacets(@Nullable List facets) { - this.facets = facets; - return this; - } - - @CheckForNull - public List getFileUuids() { - return fileUuids; - } - - public SearchWsRequest setFileUuids(@Nullable List fileUuids) { - this.fileUuids = fileUuids; - return this; - } - - @CheckForNull - public List getIssues() { - return issues; - } - - public SearchWsRequest setIssues(@Nullable List issues) { - this.issues = issues; - return this; - } - - @CheckForNull - public List getLanguages() { - return languages; - } - - public SearchWsRequest setLanguages(@Nullable List languages) { - this.languages = languages; - return this; - } - - @CheckForNull - public List getModuleUuids() { - return moduleUuids; - } - - public SearchWsRequest setModuleUuids(@Nullable List moduleUuids) { - this.moduleUuids = moduleUuids; - return this; - } - - @CheckForNull - public Boolean getOnComponentOnly() { - return onComponentOnly; - } - - public SearchWsRequest setOnComponentOnly(Boolean onComponentOnly) { - this.onComponentOnly = onComponentOnly; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public SearchWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public List getProjectKeys() { - return projectKeys; - } - - public SearchWsRequest setProjectKeys(@Nullable List projectKeys) { - this.projectKeys = projectKeys; - return this; - } - - @CheckForNull - public List getProjectUuids() { - return projectUuids; - } - - public SearchWsRequest setProjectUuids(@Nullable List projectUuids) { - this.projectUuids = projectUuids; - return this; - } - - @CheckForNull - public List getResolutions() { - return resolutions; - } - - public SearchWsRequest setResolutions(@Nullable List resolutions) { - this.resolutions = resolutions; - return this; - } - - @CheckForNull - public Boolean getResolved() { - return resolved; - } - - public SearchWsRequest setResolved(@Nullable Boolean resolved) { - this.resolved = resolved; - return this; - } - - @CheckForNull - public List getRules() { - return rules; - } - - public SearchWsRequest setRules(@Nullable List rules) { - this.rules = rules; - return this; - } - - @CheckForNull - public Boolean getSinceLeakPeriod() { - return sinceLeakPeriod; - } - - public SearchWsRequest setSinceLeakPeriod(@Nullable Boolean sinceLeakPeriod) { - this.sinceLeakPeriod = sinceLeakPeriod; - return this; - } - - @CheckForNull - public String getSort() { - return sort; - } - - public SearchWsRequest setSort(@Nullable String sort) { - this.sort = sort; - return this; - } - - @CheckForNull - public List getSeverities() { - return severities; - } - - public SearchWsRequest setSeverities(@Nullable List severities) { - this.severities = severities; - return this; - } - - @CheckForNull - public List getStatuses() { - return statuses; - } - - public SearchWsRequest setStatuses(@Nullable List statuses) { - this.statuses = statuses; - return this; - } - - @CheckForNull - public List getTags() { - return tags; - } - - public SearchWsRequest setTags(@Nullable List tags) { - this.tags = tags; - return this; - } - - @CheckForNull - public List getTypes() { - return types; - } - - public SearchWsRequest setTypes(@Nullable List types) { - this.types = types; - return this; - } - - @CheckForNull - public List getComponentRootUuids() { - return componentRootUuids; - } - - public SearchWsRequest setComponentRootUuids(List componentRootUuids) { - this.componentRootUuids = componentRootUuids; - return this; - } - - @CheckForNull - public List getComponentRoots() { - return componentRoots; - } - - public SearchWsRequest setComponentRoots(@Nullable List componentRoots) { - this.componentRoots = componentRoots; - return this; - } - - @CheckForNull - public List getComponents() { - return components; - } - - public SearchWsRequest setComponents(@Nullable List components) { - this.components = components; - return this; - } - - @CheckForNull - public List getProjects() { - return projects; - } - - public SearchWsRequest setProjects(@Nullable List projects) { - this.projects = projects; - return this; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public SearchWsRequest setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentRequest.java new file mode 100644 index 00000000000..4eb5bbcab20 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentRequest.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.measure; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ComponentRequest { + private String componentId; + private String componentKey; + private String component; + private String branch; + private List metricKeys; + private List additionalFields; + private String developerId; + private String developerKey; + + /** + * @deprecated since 6.6, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getComponentId() { + return componentId; + } + + /** + * @deprecated since 6.6, please use {@link #setComponent(String)} instead + */ + @Deprecated + public ComponentRequest setComponentId(@Nullable String componentId) { + this.componentId = componentId; + return this; + } + + /** + * @deprecated since 6.6, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getComponentKey() { + return componentKey; + } + + /** + * @deprecated since 6.6, please use {@link #setComponent(String)} instead + */ + @Deprecated + public ComponentRequest setComponentKey(@Nullable String componentKey) { + this.componentKey = componentKey; + return this; + } + + @CheckForNull + public String getComponent() { + return component; + } + + public ComponentRequest setComponent(@Nullable String component) { + this.component = component; + return this; + } + + @CheckForNull + public String getBranch() { + return branch; + } + + public ComponentRequest setBranch(@Nullable String branch) { + this.branch = branch; + return this; + } + + public List getMetricKeys() { + return metricKeys; + } + + public ComponentRequest setMetricKeys(@Nullable List metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + @CheckForNull + public List getAdditionalFields() { + return additionalFields; + } + + public ComponentRequest setAdditionalFields(@Nullable List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + @CheckForNull + public String getDeveloperId() { + return developerId; + } + + public ComponentRequest setDeveloperId(@Nullable String developerId) { + this.developerId = developerId; + return this; + } + + @CheckForNull + public String getDeveloperKey() { + return developerKey; + } + + public ComponentRequest setDeveloperKey(@Nullable String developerKey) { + this.developerKey = developerKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java new file mode 100644 index 00000000000..fa6bb474a70 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java @@ -0,0 +1,242 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.measure; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ComponentTreeRequest { + + private String baseComponentId; + private String baseComponentKey; + private String component; + private String branch; + private String strategy; + private List qualifiers; + private List additionalFields; + private String query; + private List sort; + private Boolean asc; + private String metricSort; + private Integer metricPeriodSort; + private String metricSortFilter; + private List metricKeys; + private Integer page; + private Integer pageSize; + private String developerId; + private String developerKey; + + /** + * @deprecated since 6.6, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getBaseComponentId() { + return baseComponentId; + } + + /** + * @deprecated since 6.6, please use {@link #setComponent(String)} instead + */ + @Deprecated + public ComponentTreeRequest setBaseComponentId(@Nullable String baseComponentId) { + this.baseComponentId = baseComponentId; + return this; + } + + /** + * @deprecated since 6.6, please use {@link #getComponent()} instead + */ + @Deprecated + @CheckForNull + public String getBaseComponentKey() { + return baseComponentKey; + } + + /** + * @deprecated since 6.6, please use {@link #setComponent(String)} instead + */ + @Deprecated + public ComponentTreeRequest setBaseComponentKey(@Nullable String baseComponentKey) { + this.baseComponentKey = baseComponentKey; + return this; + } + + @CheckForNull + public String getComponent() { + return component; + } + + public ComponentTreeRequest setComponent(@Nullable String component) { + this.component = component; + return this; + } + + @CheckForNull + public String getBranch() { + return branch; + } + + public ComponentTreeRequest setBranch(@Nullable String branch) { + this.branch = branch; + return this; + } + + @CheckForNull + public String getStrategy() { + return strategy; + } + + public ComponentTreeRequest setStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + @CheckForNull + public List getQualifiers() { + return qualifiers; + } + + public ComponentTreeRequest setQualifiers(@Nullable List qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + @CheckForNull + public List getAdditionalFields() { + return additionalFields; + } + + public ComponentTreeRequest setAdditionalFields(@Nullable List additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public ComponentTreeRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public List getSort() { + return sort; + } + + public ComponentTreeRequest setSort(@Nullable List sort) { + this.sort = sort; + return this; + } + + @CheckForNull + public String getMetricSort() { + return metricSort; + } + + public ComponentTreeRequest setMetricSort(@Nullable String metricSort) { + this.metricSort = metricSort; + return this; + } + + @CheckForNull + public String getMetricSortFilter() { + return metricSortFilter; + } + + public ComponentTreeRequest setMetricSortFilter(@Nullable String metricSortFilter) { + this.metricSortFilter = metricSortFilter; + return this; + } + + @CheckForNull + public List getMetricKeys() { + return metricKeys; + } + + public ComponentTreeRequest setMetricKeys(List metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + @CheckForNull + public Boolean getAsc() { + return asc; + } + + public ComponentTreeRequest setAsc(@Nullable Boolean asc) { + this.asc = asc; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public ComponentTreeRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public ComponentTreeRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public Integer getMetricPeriodSort() { + return metricPeriodSort; + } + + public ComponentTreeRequest setMetricPeriodSort(@Nullable Integer metricPeriodSort) { + this.metricPeriodSort = metricPeriodSort; + return this; + } + + @CheckForNull + public String getDeveloperId() { + return developerId; + } + + public ComponentTreeRequest setDeveloperId(@Nullable String developerId) { + this.developerId = developerId; + return this; + } + + @CheckForNull + public String getDeveloperKey() { + return developerKey; + } + + public ComponentTreeRequest setDeveloperKey(@Nullable String developerKey) { + this.developerKey = developerKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java deleted file mode 100644 index 0a89515828a..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java +++ /dev/null @@ -1,242 +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.measure; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ComponentTreeWsRequest { - - private String baseComponentId; - private String baseComponentKey; - private String component; - private String branch; - private String strategy; - private List qualifiers; - private List additionalFields; - private String query; - private List sort; - private Boolean asc; - private String metricSort; - private Integer metricPeriodSort; - private String metricSortFilter; - private List metricKeys; - private Integer page; - private Integer pageSize; - private String developerId; - private String developerKey; - - /** - * @deprecated since 6.6, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getBaseComponentId() { - return baseComponentId; - } - - /** - * @deprecated since 6.6, please use {@link #setComponent(String)} instead - */ - @Deprecated - public ComponentTreeWsRequest setBaseComponentId(@Nullable String baseComponentId) { - this.baseComponentId = baseComponentId; - return this; - } - - /** - * @deprecated since 6.6, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getBaseComponentKey() { - return baseComponentKey; - } - - /** - * @deprecated since 6.6, please use {@link #setComponent(String)} instead - */ - @Deprecated - public ComponentTreeWsRequest setBaseComponentKey(@Nullable String baseComponentKey) { - this.baseComponentKey = baseComponentKey; - return this; - } - - @CheckForNull - public String getComponent() { - return component; - } - - public ComponentTreeWsRequest setComponent(@Nullable String component) { - this.component = component; - return this; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public ComponentTreeWsRequest setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - @CheckForNull - public String getStrategy() { - return strategy; - } - - public ComponentTreeWsRequest setStrategy(String strategy) { - this.strategy = strategy; - return this; - } - - @CheckForNull - public List getQualifiers() { - return qualifiers; - } - - public ComponentTreeWsRequest setQualifiers(@Nullable List qualifiers) { - this.qualifiers = qualifiers; - return this; - } - - @CheckForNull - public List getAdditionalFields() { - return additionalFields; - } - - public ComponentTreeWsRequest setAdditionalFields(@Nullable List additionalFields) { - this.additionalFields = additionalFields; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public ComponentTreeWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public List getSort() { - return sort; - } - - public ComponentTreeWsRequest setSort(@Nullable List sort) { - this.sort = sort; - return this; - } - - @CheckForNull - public String getMetricSort() { - return metricSort; - } - - public ComponentTreeWsRequest setMetricSort(@Nullable String metricSort) { - this.metricSort = metricSort; - return this; - } - - @CheckForNull - public String getMetricSortFilter() { - return metricSortFilter; - } - - public ComponentTreeWsRequest setMetricSortFilter(@Nullable String metricSortFilter) { - this.metricSortFilter = metricSortFilter; - return this; - } - - @CheckForNull - public List getMetricKeys() { - return metricKeys; - } - - public ComponentTreeWsRequest setMetricKeys(List metricKeys) { - this.metricKeys = metricKeys; - return this; - } - - @CheckForNull - public Boolean getAsc() { - return asc; - } - - public ComponentTreeWsRequest setAsc(@Nullable Boolean asc) { - this.asc = asc; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public ComponentTreeWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public ComponentTreeWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public Integer getMetricPeriodSort() { - return metricPeriodSort; - } - - public ComponentTreeWsRequest setMetricPeriodSort(@Nullable Integer metricPeriodSort) { - this.metricPeriodSort = metricPeriodSort; - return this; - } - - @CheckForNull - public String getDeveloperId() { - return developerId; - } - - public ComponentTreeWsRequest setDeveloperId(@Nullable String developerId) { - this.developerId = developerId; - return this; - } - - @CheckForNull - public String getDeveloperKey() { - return developerKey; - } - - public ComponentTreeWsRequest setDeveloperKey(@Nullable String developerKey) { - this.developerKey = developerKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentWsRequest.java deleted file mode 100644 index cc6e10ef7d9..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentWsRequest.java +++ /dev/null @@ -1,130 +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.measure; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ComponentWsRequest { - private String componentId; - private String componentKey; - private String component; - private String branch; - private List metricKeys; - private List additionalFields; - private String developerId; - private String developerKey; - - /** - * @deprecated since 6.6, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getComponentId() { - return componentId; - } - - /** - * @deprecated since 6.6, please use {@link #setComponent(String)} instead - */ - @Deprecated - public ComponentWsRequest setComponentId(@Nullable String componentId) { - this.componentId = componentId; - return this; - } - - /** - * @deprecated since 6.6, please use {@link #getComponent()} instead - */ - @Deprecated - @CheckForNull - public String getComponentKey() { - return componentKey; - } - - /** - * @deprecated since 6.6, please use {@link #setComponent(String)} instead - */ - @Deprecated - public ComponentWsRequest setComponentKey(@Nullable String componentKey) { - this.componentKey = componentKey; - return this; - } - - @CheckForNull - public String getComponent() { - return component; - } - - public ComponentWsRequest setComponent(@Nullable String component) { - this.component = component; - return this; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public ComponentWsRequest setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - public List getMetricKeys() { - return metricKeys; - } - - public ComponentWsRequest setMetricKeys(@Nullable List metricKeys) { - this.metricKeys = metricKeys; - return this; - } - - @CheckForNull - public List getAdditionalFields() { - return additionalFields; - } - - public ComponentWsRequest setAdditionalFields(@Nullable List additionalFields) { - this.additionalFields = additionalFields; - return this; - } - - @CheckForNull - public String getDeveloperId() { - return developerId; - } - - public ComponentWsRequest setDeveloperId(@Nullable String developerId) { - this.developerId = developerId; - return this; - } - - @CheckForNull - public String getDeveloperKey() { - return developerKey; - } - - public ComponentWsRequest setDeveloperKey(@Nullable String developerKey) { - this.developerKey = developerKey; - return this; - } -} 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 0b0afb29cb0..201a0c9b0d5 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 @@ -56,7 +56,7 @@ public class MeasuresService extends BaseService { super(wsConnector, CONTROLLER_MEASURES); } - public ComponentTreeWsResponse componentTree(ComponentTreeWsRequest request) { + public ComponentTreeWsResponse componentTree(ComponentTreeRequest request) { GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT_TREE)) .setParam(DEPRECATED_PARAM_BASE_COMPONENT_ID, request.getBaseComponentId()) .setParam(DEPRECATED_PARAM_BASE_COMPONENT_KEY, request.getBaseComponentKey()) @@ -79,7 +79,7 @@ public class MeasuresService extends BaseService { return call(getRequest, ComponentTreeWsResponse.parser()); } - public ComponentWsResponse component(ComponentWsRequest request) { + public ComponentWsResponse component(ComponentRequest request) { GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT)) .setParam(DEPRECATED_PARAM_COMPONENT_ID, request.getComponentId()) .setParam(DEPRECATED_PARAM_COMPONENT_KEY, request.getComponentKey()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateRequest.java new file mode 100644 index 00000000000..000426a2833 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateRequest.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.organization; + +import javax.annotation.concurrent.Immutable; + +@Immutable +public class CreateRequest { + private final String name; + private final String key; + private final String description; + private final String url; + private final String avatar; + + private CreateRequest(Builder builder) { + this.name = builder.name; + this.key = builder.key; + this.description = builder.description; + this.url = builder.url; + this.avatar = builder.avatar; + } + + public String getName() { + return name; + } + + public String getKey() { + return key; + } + + public String getDescription() { + return description; + } + + public String getUrl() { + return url; + } + + public String getAvatar() { + return avatar; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String name; + private String key; + private String description; + private String url; + private String avatar; + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Builder setDescription(String description) { + this.description = description; + return this; + } + + public Builder setUrl(String url) { + this.url = url; + return this; + } + + public Builder setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public CreateRequest build() { + return new CreateRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateWsRequest.java deleted file mode 100644 index e8b2073dddc..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateWsRequest.java +++ /dev/null @@ -1,100 +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.organization; - -import javax.annotation.concurrent.Immutable; - -@Immutable -public class CreateWsRequest { - private final String name; - private final String key; - private final String description; - private final String url; - private final String avatar; - - private CreateWsRequest(Builder builder) { - this.name = builder.name; - this.key = builder.key; - this.description = builder.description; - this.url = builder.url; - this.avatar = builder.avatar; - } - - public String getName() { - return name; - } - - public String getKey() { - return key; - } - - public String getDescription() { - return description; - } - - public String getUrl() { - return url; - } - - public String getAvatar() { - return avatar; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String name; - private String key; - private String description; - private String url; - private String avatar; - - public Builder setName(String name) { - this.name = name; - return this; - } - - public Builder setKey(String key) { - this.key = key; - return this; - } - - public Builder setDescription(String description) { - this.description = description; - return this; - } - - public Builder setUrl(String url) { - this.url = url; - return this; - } - - public Builder setAvatar(String avatar) { - this.avatar = avatar; - return this; - } - - public CreateWsRequest build() { - return new CreateWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java index 7ef6337f055..96bac737a3a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java @@ -40,7 +40,7 @@ public class OrganizationService extends BaseService { super(wsConnector, "api/organizations"); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { GetRequest get = new GetRequest(path("search")) .setParam("organizations", inlineMultipleParamValue(request.getOrganizations())) .setParam(PAGE, request.getPage()) @@ -49,7 +49,7 @@ public class OrganizationService extends BaseService { return call(get, SearchWsResponse.parser()); } - public CreateWsResponse create(CreateWsRequest request) { + public CreateWsResponse create(CreateRequest request) { PostRequest post = new PostRequest(path("create")) .setParam("name", request.getName()) .setParam("key", request.getKey()) @@ -60,7 +60,7 @@ public class OrganizationService extends BaseService { return call(post, CreateWsResponse.parser()); } - public UpdateWsResponse update(UpdateWsRequest request) { + public UpdateWsResponse update(UpdateRequest request) { PostRequest post = new PostRequest(path("update")) .setParam("key", request.getKey()) .setParam("name", request.getName()) @@ -78,7 +78,7 @@ public class OrganizationService extends BaseService { call(post).failIfNotSuccessful(); } - public SearchMembersWsResponse searchMembers(SearchMembersWsRequest request) { + public SearchMembersWsResponse searchMembers(SearchMembersRequest request) { GetRequest get = new GetRequest(path("search_members")) .setParam("organization", request.getOrganization()) .setParam("selected", request.getSelected()) @@ -105,7 +105,7 @@ public class OrganizationService extends BaseService { call(post); } - public void updateProjectVisibility(UpdateProjectVisibilityWsRequest request) { + public void updateProjectVisibility(UpdateProjectVisibilityRequest request) { PostRequest post = new PostRequest(path("update_project_visibility")) .setParam("organization", request.getOrganization()) .setParam("projectVisibility", request.getProjectVisibility()); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.java new file mode 100644 index 00000000000..341a930d887 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.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.organization; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchMembersRequest { + private String organization; + private String selected; + private String query; + private Integer page; + private Integer pageSize; + + @CheckForNull + public String getOrganization() { + return organization; + } + + public SearchMembersRequest setOrganization(@Nullable String organization) { + this.organization = organization; + return this; + } + + @CheckForNull + public String getSelected() { + return selected; + } + + public SearchMembersRequest setSelected(@Nullable String selected) { + this.selected = selected; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchMembersRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public SearchMembersRequest setPage(@Nullable Integer page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public SearchMembersRequest setPageSize(@Nullable Integer pageSize) { + this.pageSize = pageSize; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersWsRequest.java deleted file mode 100644 index 06e8376117c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersWsRequest.java +++ /dev/null @@ -1,82 +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.organization; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchMembersWsRequest { - private String organization; - private String selected; - private String query; - private Integer page; - private Integer pageSize; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public SearchMembersWsRequest setOrganization(@Nullable String organization) { - this.organization = organization; - return this; - } - - @CheckForNull - public String getSelected() { - return selected; - } - - public SearchMembersWsRequest setSelected(@Nullable String selected) { - this.selected = selected; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchMembersWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchMembersWsRequest setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchMembersWsRequest setPageSize(@Nullable Integer pageSize) { - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.java new file mode 100644 index 00000000000..b3363ab8016 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.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.organization; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +import static java.util.Arrays.asList; + +@Immutable +public class SearchRequest { + private final Integer page; + private final Integer pageSize; + private final List organizations; + + private SearchRequest(Builder builder) { + this.page = builder.page; + this.pageSize = builder.pageSize; + this.organizations = builder.organizations; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + @CheckForNull + public List getOrganizations() { + return organizations; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Integer page; + private Integer pageSize; + private List organizations; + + public Builder setPage(@Nullable Integer page) { + this.page = page; + return this; + } + + public Builder setPageSize(@Nullable Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + public Builder setOrganizations(String... organizations) { + this.organizations = asList(organizations); + return this; + } + + public SearchRequest build() { + return new SearchRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchWsRequest.java deleted file mode 100644 index 92dbfb5d88e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchWsRequest.java +++ /dev/null @@ -1,84 +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.organization; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static java.util.Arrays.asList; - -@Immutable -public class SearchWsRequest { - private final Integer page; - private final Integer pageSize; - private final List organizations; - - private SearchWsRequest(Builder builder) { - this.page = builder.page; - this.pageSize = builder.pageSize; - this.organizations = builder.organizations; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - @CheckForNull - public List getOrganizations() { - return organizations; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private Integer page; - private Integer pageSize; - private List organizations; - - public Builder setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - public Builder setPageSize(@Nullable Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - public Builder setOrganizations(String... organizations) { - this.organizations = asList(organizations); - return this; - } - - public SearchWsRequest build() { - return new SearchWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.java new file mode 100644 index 00000000000..e6e320a66f4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.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.organization; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +@Immutable +public class UpdateProjectVisibilityRequest { + private final String organization; + private final String projectVisibility; + + private UpdateProjectVisibilityRequest(Builder builder) { + this.organization = builder.organization; + this.projectVisibility = builder.projectVisibility; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + @CheckForNull + public String getProjectVisibility() { + return projectVisibility; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String organization; + private String projectVisibility; + + public Builder setOrganization(@Nullable String organization) { + this.organization = organization; + return this; + } + + public Builder setProjectVisibility(@Nullable String projectVisibility) { + this.projectVisibility = projectVisibility; + return this; + } + + public UpdateProjectVisibilityRequest build() { + return new UpdateProjectVisibilityRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityWsRequest.java deleted file mode 100644 index e7af9537548..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityWsRequest.java +++ /dev/null @@ -1,68 +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.organization; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class UpdateProjectVisibilityWsRequest { - private final String organization; - private final String projectVisibility; - - private UpdateProjectVisibilityWsRequest(Builder builder) { - this.organization = builder.organization; - this.projectVisibility = builder.projectVisibility; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - @CheckForNull - public String getProjectVisibility() { - return projectVisibility; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String organization; - private String projectVisibility; - - public Builder setOrganization(@Nullable String organization) { - this.organization = organization; - return this; - } - - public Builder setProjectVisibility(@Nullable String projectVisibility) { - this.projectVisibility = projectVisibility; - return this; - } - - public UpdateProjectVisibilityWsRequest build() { - return new UpdateProjectVisibilityWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.java new file mode 100644 index 00000000000..eb2de7b7e6d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.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.organization; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +@Immutable +public class UpdateRequest { + private final String key; + private final String name; + private final String description; + private final String url; + private final String avatar; + + private UpdateRequest(Builder builder) { + this.name = builder.name; + this.key = builder.key; + this.description = builder.description; + this.url = builder.url; + this.avatar = builder.avatar; + } + + @CheckForNull + public String getName() { + return name; + } + + @CheckForNull + public String getKey() { + return key; + } + + @CheckForNull + public String getDescription() { + return description; + } + + @CheckForNull + public String getUrl() { + return url; + } + + @CheckForNull + public String getAvatar() { + return avatar; + } + + public static class Builder { + private String key; + private String name; + private String description; + private String url; + private String avatar; + + public Builder setKey(@Nullable String key) { + this.key = key; + return this; + } + + public Builder setName(@Nullable String name) { + this.name = name; + return this; + } + + public Builder setDescription(@Nullable String description) { + this.description = description; + return this; + } + + public Builder setUrl(@Nullable String url) { + this.url = url; + return this; + } + + public Builder setAvatar(@Nullable String avatar) { + this.avatar = avatar; + return this; + } + + public UpdateRequest build() { + return new UpdateRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateWsRequest.java deleted file mode 100644 index e7b15a97f0f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateWsRequest.java +++ /dev/null @@ -1,103 +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.organization; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class UpdateWsRequest { - private final String key; - private final String name; - private final String description; - private final String url; - private final String avatar; - - private UpdateWsRequest(Builder builder) { - this.name = builder.name; - this.key = builder.key; - this.description = builder.description; - this.url = builder.url; - this.avatar = builder.avatar; - } - - @CheckForNull - public String getName() { - return name; - } - - @CheckForNull - public String getKey() { - return key; - } - - @CheckForNull - public String getDescription() { - return description; - } - - @CheckForNull - public String getUrl() { - return url; - } - - @CheckForNull - public String getAvatar() { - return avatar; - } - - public static class Builder { - private String key; - private String name; - private String description; - private String url; - private String avatar; - - public Builder setKey(@Nullable String key) { - this.key = key; - return this; - } - - public Builder setName(@Nullable String name) { - this.name = name; - return this; - } - - public Builder setDescription(@Nullable String description) { - this.description = description; - return this; - } - - public Builder setUrl(@Nullable String url) { - this.url = url; - return this; - } - - public Builder setAvatar(@Nullable String avatar) { - this.avatar = avatar; - return this; - } - - public UpdateWsRequest build() { - return new UpdateWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java new file mode 100644 index 00000000000..4a70ebc5ebb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class AddGroupRequest { + private String permission; + private String groupId; + private String organization; + private String groupName; + private String projectId; + private String projectKey; + + public String getPermission() { + return permission; + } + + public AddGroupRequest setPermission(String permission) { + this.permission = requireNonNull(permission, "permission must not be null"); + return this; + } + + @CheckForNull + public String getGroupId() { + return groupId; + } + + public AddGroupRequest setGroupId(@Nullable String groupId) { + this.groupId = groupId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public AddGroupRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getGroupName() { + return groupName; + } + + public AddGroupRequest setGroupName(@Nullable String groupName) { + this.groupName = groupName; + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public AddGroupRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public AddGroupRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.java new file mode 100644 index 00000000000..a28c8ce7131 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class AddGroupToTemplateRequest { + private String groupId; + private String groupName; + private String permission; + private String templateId; + private String templateName; + + @CheckForNull + public String getGroupId() { + return groupId; + } + + public AddGroupToTemplateRequest setGroupId(@Nullable String groupId) { + this.groupId = groupId; + return this; + } + + @CheckForNull + public String getGroupName() { + return groupName; + } + + public AddGroupToTemplateRequest setGroupName(@Nullable String groupName) { + this.groupName = groupName; + return this; + } + + public String getPermission() { + return permission; + } + + public AddGroupToTemplateRequest setPermission(String permission) { + this.permission = requireNonNull(permission, "permission must not be null"); + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public AddGroupToTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public AddGroupToTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java deleted file mode 100644 index fde92b46dfe..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateWsRequest.java +++ /dev/null @@ -1,82 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddGroupToTemplateWsRequest { - private String groupId; - private String groupName; - private String permission; - private String templateId; - private String templateName; - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public AddGroupToTemplateWsRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public AddGroupToTemplateWsRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - public String getPermission() { - return permission; - } - - public AddGroupToTemplateWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public AddGroupToTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public AddGroupToTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java deleted file mode 100644 index 99233d65875..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupWsRequest.java +++ /dev/null @@ -1,93 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddGroupWsRequest { - private String permission; - private String groupId; - private String organization; - private String groupName; - private String projectId; - private String projectKey; - - public String getPermission() { - return permission; - } - - public AddGroupWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public AddGroupWsRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddGroupWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public AddGroupWsRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public AddGroupWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public AddGroupWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.java new file mode 100644 index 00000000000..a17c90cfc80 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +import static java.util.Objects.requireNonNull; + +@Immutable +public class AddProjectCreatorToTemplateRequest { + private final String templateId; + private final String organization; + private final String templateName; + private final String permission; + + private AddProjectCreatorToTemplateRequest(Builder builder) { + this.templateId = builder.templateId; + this.organization = builder.organization; + this.templateName = builder.templateName; + this.permission = requireNonNull(builder.permission); + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public String getPermission() { + return permission; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String templateId; + private String organization; + private String templateName; + private String permission; + + private Builder() { + // enforce method constructor + } + + public Builder setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + public Builder setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + public Builder setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } + + public Builder setPermission(@Nullable String permission) { + this.permission = permission; + return this; + } + + public AddProjectCreatorToTemplateRequest build() { + return new AddProjectCreatorToTemplateRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateWsRequest.java deleted file mode 100644 index 1a438241b80..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateWsRequest.java +++ /dev/null @@ -1,99 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static java.util.Objects.requireNonNull; - -@Immutable -public class AddProjectCreatorToTemplateWsRequest { - private final String templateId; - private final String organization; - private final String templateName; - private final String permission; - - private AddProjectCreatorToTemplateWsRequest(Builder builder) { - this.templateId = builder.templateId; - this.organization = builder.organization; - this.templateName = builder.templateName; - this.permission = requireNonNull(builder.permission); - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public String getPermission() { - return permission; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String templateId; - private String organization; - private String templateName; - private String permission; - - private Builder() { - // enforce method constructor - } - - public Builder setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - public Builder setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - public Builder setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - public Builder setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - public AddProjectCreatorToTemplateWsRequest build() { - return new AddProjectCreatorToTemplateWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.java new file mode 100644 index 00000000000..fa3c9beef44 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class AddUserRequest { + private String login; + private String permission; + private String projectId; + private String projectKey; + private String organization; + + public String getLogin() { + return login; + } + + public AddUserRequest setLogin(String login) { + this.login = requireNonNull(login, "login must not be null"); + return this; + } + + public String getPermission() { + return permission; + } + + public AddUserRequest setPermission(String permission) { + this.permission = requireNonNull(permission, "permission must not be null"); + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public AddUserRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public AddUserRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public AddUserRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.java new file mode 100644 index 00000000000..5b4c686471d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class AddUserToTemplateRequest { + private String login; + private String permission; + private String templateId; + private String organization; + private String templateName; + + public String getLogin() { + return login; + } + + public AddUserToTemplateRequest setLogin(String login) { + this.login = requireNonNull(login); + return this; + } + + public String getPermission() { + return permission; + } + + public AddUserToTemplateRequest setPermission(String permission) { + this.permission = requireNonNull(permission); + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public AddUserToTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public AddUserToTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public AddUserToTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateWsRequest.java deleted file mode 100644 index 21a79238539..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateWsRequest.java +++ /dev/null @@ -1,81 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddUserToTemplateWsRequest { - private String login; - private String permission; - private String templateId; - private String organization; - private String templateName; - - public String getLogin() { - return login; - } - - public AddUserToTemplateWsRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - public String getPermission() { - return permission; - } - - public AddUserToTemplateWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public AddUserToTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public AddUserToTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddUserToTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserWsRequest.java deleted file mode 100644 index 0908e394bdd..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserWsRequest.java +++ /dev/null @@ -1,81 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddUserWsRequest { - private String login; - private String permission; - private String projectId; - private String projectKey; - private String organization; - - public String getLogin() { - return login; - } - - public AddUserWsRequest setLogin(String login) { - this.login = requireNonNull(login, "login must not be null"); - return this; - } - - public String getPermission() { - return permission; - } - - public AddUserWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public AddUserWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public AddUserWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddUserWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.java new file mode 100644 index 00000000000..525e1a53b77 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ApplyTemplateRequest { + private String projectId; + private String projectKey; + private String templateId; + private String organization; + private String templateName; + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public ApplyTemplateRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public ApplyTemplateRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public ApplyTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public ApplyTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public ApplyTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java deleted file mode 100644 index edab49561fb..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java +++ /dev/null @@ -1,80 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ApplyTemplateWsRequest { - private String projectId; - private String projectKey; - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public ApplyTemplateWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public ApplyTemplateWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public ApplyTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public ApplyTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public ApplyTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.java new file mode 100644 index 00000000000..6b78de83cd1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.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.permission; + +import java.util.Collection; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.sonar.api.resources.Qualifiers; + +import static java.util.Collections.singleton; +import static java.util.Objects.requireNonNull; + +public class BulkApplyTemplateRequest { + private String templateId; + private String organization; + private String templateName; + private String query; + private Collection qualifiers = singleton(Qualifiers.PROJECT); + private String visibility; + private String analyzedBefore; + private boolean onProvisionedOnly = false; + private Collection projects; + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public BulkApplyTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public BulkApplyTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public BulkApplyTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public BulkApplyTemplateRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + public Collection getQualifiers() { + return qualifiers; + } + + public BulkApplyTemplateRequest setQualifiers(Collection qualifiers) { + this.qualifiers = requireNonNull(qualifiers); + return this; + } + + @CheckForNull + public String getVisibility() { + return visibility; + } + + public BulkApplyTemplateRequest setVisibility(@Nullable String visibility) { + this.visibility = visibility; + return this; + } + + @CheckForNull + public String getAnalyzedBefore() { + return analyzedBefore; + } + + public BulkApplyTemplateRequest setAnalyzedBefore(@Nullable String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public boolean isOnProvisionedOnly() { + return onProvisionedOnly; + } + + public BulkApplyTemplateRequest setOnProvisionedOnly(boolean onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + @CheckForNull + public Collection getProjects() { + return projects; + } + + public BulkApplyTemplateRequest setProjects(@Nullable Collection projects) { + this.projects = projects; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateWsRequest.java deleted file mode 100644 index bb17eb37572..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateWsRequest.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.permission; - -import java.util.Collection; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.resources.Qualifiers; - -import static java.util.Collections.singleton; -import static java.util.Objects.requireNonNull; - -public class BulkApplyTemplateWsRequest { - private String templateId; - private String organization; - private String templateName; - private String query; - private Collection qualifiers = singleton(Qualifiers.PROJECT); - private String visibility; - private String analyzedBefore; - private boolean onProvisionedOnly = false; - private Collection projects; - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public BulkApplyTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public BulkApplyTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public BulkApplyTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public BulkApplyTemplateWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - public Collection getQualifiers() { - return qualifiers; - } - - public BulkApplyTemplateWsRequest setQualifiers(Collection qualifiers) { - this.qualifiers = requireNonNull(qualifiers); - return this; - } - - @CheckForNull - public String getVisibility() { - return visibility; - } - - public BulkApplyTemplateWsRequest setVisibility(@Nullable String visibility) { - this.visibility = visibility; - return this; - } - - @CheckForNull - public String getAnalyzedBefore() { - return analyzedBefore; - } - - public BulkApplyTemplateWsRequest setAnalyzedBefore(@Nullable String analyzedBefore) { - this.analyzedBefore = analyzedBefore; - return this; - } - - public boolean isOnProvisionedOnly() { - return onProvisionedOnly; - } - - public BulkApplyTemplateWsRequest setOnProvisionedOnly(boolean onProvisionedOnly) { - this.onProvisionedOnly = onProvisionedOnly; - return this; - } - - @CheckForNull - public Collection getProjects() { - return projects; - } - - public BulkApplyTemplateWsRequest setProjects(@Nullable Collection projects) { - this.projects = projects; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.java new file mode 100644 index 00000000000..6b1768a1a3a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class CreateTemplateRequest { + private String description; + private String name; + private String projectKeyPattern; + private String organization; + + @CheckForNull + public String getDescription() { + return description; + } + + public CreateTemplateRequest setDescription(@Nullable String description) { + this.description = description; + return this; + } + + public String getName() { + return name; + } + + public CreateTemplateRequest setName(String name) { + this.name = requireNonNull(name); + return this; + } + + @CheckForNull + public String getProjectKeyPattern() { + return projectKeyPattern; + } + + public CreateTemplateRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public CreateTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateWsRequest.java deleted file mode 100644 index 65f9d3a6eb4..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateWsRequest.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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class CreateTemplateWsRequest { - private String description; - private String name; - private String projectKeyPattern; - private String organization; - - @CheckForNull - public String getDescription() { - return description; - } - - public CreateTemplateWsRequest setDescription(@Nullable String description) { - this.description = description; - return this; - } - - public String getName() { - return name; - } - - public CreateTemplateWsRequest setName(String name) { - this.name = requireNonNull(name); - return this; - } - - @CheckForNull - public String getProjectKeyPattern() { - return projectKeyPattern; - } - - public CreateTemplateWsRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { - this.projectKeyPattern = projectKeyPattern; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public CreateTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java new file mode 100644 index 00000000000..69582aec5bc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java @@ -0,0 +1,59 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class DeleteTemplateRequest { + private String templateId; + private String organization; + private String templateName; + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public DeleteTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public DeleteTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public DeleteTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateWsRequest.java deleted file mode 100644 index 50b975b7487..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateWsRequest.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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class DeleteTemplateWsRequest { - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public DeleteTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public DeleteTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public DeleteTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.java new file mode 100644 index 00000000000..641729bae9d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class GroupsRequest { + private String permission; + private String projectId; + private String projectKey; + private Integer page; + private Integer pageSize; + private String query; + + @CheckForNull + public String getPermission() { + return permission; + } + + public GroupsRequest setPermission(@Nullable String permission) { + this.permission = permission; + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public GroupsRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public GroupsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public GroupsRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public GroupsRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public GroupsRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java deleted file mode 100644 index 9ec6431fcea..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsWsRequest.java +++ /dev/null @@ -1,92 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class GroupsWsRequest { - private String permission; - private String projectId; - private String projectKey; - private Integer page; - private Integer pageSize; - private String query; - - @CheckForNull - public String getPermission() { - return permission; - } - - public GroupsWsRequest setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public GroupsWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public GroupsWsRequest setProjectKey(String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public GroupsWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public GroupsWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public GroupsWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } -} 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 c0488373597..e6e353bff5b 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 @@ -53,7 +53,7 @@ public class PermissionsService extends BaseService { super(wsConnector, PermissionsWsParameters.CONTROLLER); } - public Permissions.WsGroupsResponse groups(GroupsWsRequest request) { + public Permissions.WsGroupsResponse groups(GroupsRequest request) { GetRequest get = new GetRequest(path("groups")) .setParam(PARAM_PERMISSION, request.getPermission()) .setParam(PARAM_PROJECT_ID, request.getProjectId()) @@ -64,7 +64,7 @@ public class PermissionsService extends BaseService { return call(get, Permissions.WsGroupsResponse.parser()); } - public void addGroup(AddGroupWsRequest request) { + public void addGroup(AddGroupRequest request) { call(new PostRequest(path("add_group")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -74,7 +74,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_GROUP_NAME, request.getGroupName())); } - public void addGroupToTemplate(AddGroupToTemplateWsRequest request) { + public void addGroupToTemplate(AddGroupToTemplateRequest request) { call(new PostRequest(path("add_group_to_template")) .setParam(PARAM_GROUP_ID, request.getGroupId()) .setParam(PARAM_GROUP_NAME, request.getGroupName()) @@ -83,7 +83,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void addUser(AddUserWsRequest request) { + public void addUser(AddUserRequest request) { call(new PostRequest(path("add_user")) .setParam(PARAM_USER_LOGIN, request.getLogin()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -92,7 +92,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_ORGANIZATION, request.getOrganization())); } - public void addUserToTemplate(AddUserToTemplateWsRequest request) { + public void addUserToTemplate(AddUserToTemplateRequest request) { call(new PostRequest(path("add_user_to_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -101,7 +101,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest request) { + public void addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest request) { call(new PostRequest(path("add_project_creator_to_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -109,7 +109,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void applyTemplate(ApplyTemplateWsRequest request) { + public void applyTemplate(ApplyTemplateRequest request) { call(new PostRequest(path("apply_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PROJECT_ID, request.getProjectId()) @@ -118,7 +118,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void bulkApplyTemplate(BulkApplyTemplateWsRequest request) { + public void bulkApplyTemplate(BulkApplyTemplateRequest request) { call(new PostRequest(path("bulk_apply_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) @@ -131,7 +131,7 @@ public class PermissionsService extends BaseService { .setParam(ProjectsWsParameters.PARAM_PROJECTS, inlineMultipleParamValue(request.getProjects()))); } - public CreateTemplateWsResponse createTemplate(CreateTemplateWsRequest request) { + public CreateTemplateWsResponse createTemplate(CreateTemplateRequest request) { PostRequest post = new PostRequest(path("create_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_NAME, request.getName()) @@ -140,14 +140,14 @@ public class PermissionsService extends BaseService { return call(post, CreateTemplateWsResponse.parser()); } - public void deleteTemplate(DeleteTemplateWsRequest request) { + public void deleteTemplate(DeleteTemplateRequest request) { call(new PostRequest(path("delete_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void removeGroup(RemoveGroupWsRequest request) { + public void removeGroup(RemoveGroupRequest request) { call(new PostRequest(path("remove_group")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -157,7 +157,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); } - public void removeGroupFromTemplate(RemoveGroupFromTemplateWsRequest request) { + public void removeGroupFromTemplate(RemoveGroupFromTemplateRequest request) { call(new PostRequest(path("remove_group_from_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -167,7 +167,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest request) { + public void removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest request) { call( new PostRequest(path("remove_project_creator_from_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) @@ -176,7 +176,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public void removeUser(RemoveUserWsRequest request) { + public void removeUser(RemoveUserRequest request) { call(new PostRequest(path("remove_user")) .setParam(PARAM_PERMISSION, request.getPermission()) .setParam(PARAM_USER_LOGIN, request.getLogin()) @@ -184,7 +184,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); } - public void removeUserFromTemplate(RemoveUserFromTemplateWsRequest request) { + public void removeUserFromTemplate(RemoveUserFromTemplateRequest request) { call(new PostRequest(path("remove_user_from_template")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) @@ -198,7 +198,7 @@ public class PermissionsService extends BaseService { return call(get, WsSearchGlobalPermissionsResponse.parser()); } - public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsWsRequest request) { + public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsRequest request) { GetRequest get = new GetRequest(path("search_project_permissions")) .setParam(PARAM_PROJECT_ID, request.getProjectId()) .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) @@ -209,20 +209,20 @@ public class PermissionsService extends BaseService { return call(get, SearchProjectPermissionsWsResponse.parser()); } - public SearchTemplatesWsResponse searchTemplates(SearchTemplatesWsRequest request) { + public SearchTemplatesWsResponse searchTemplates(SearchTemplatesRequest request) { GetRequest get = new GetRequest(path("search_templates")) .setParam("q", request.getQuery()); return call(get, SearchTemplatesWsResponse.parser()); } - public void setDefaultTemplate(SetDefaultTemplateWsRequest request) { + public void setDefaultTemplate(SetDefaultTemplateRequest request) { call(new PostRequest(path("set_default_template")) .setParam(PARAM_QUALIFIER, request.getQualifier()) .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } - public UpdateTemplateWsResponse updateTemplate(UpdateTemplateWsRequest request) { + public UpdateTemplateWsResponse updateTemplate(UpdateTemplateRequest request) { return call(new PostRequest(path("update_template")) .setParam(PARAM_DESCRIPTION, request.getDescription()) .setParam(PARAM_ID, request.getId()) @@ -230,7 +230,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_PROJECT_KEY_PATTERN, request.getProjectKeyPattern()), UpdateTemplateWsResponse.parser()); } - public UsersWsResponse users(UsersWsRequest request) { + public UsersWsResponse users(UsersRequest request) { return call(new GetRequest(path("users")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_PERMISSION, request.getPermission()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java new file mode 100644 index 00000000000..b64c3d6f1ab --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class RemoveGroupFromTemplateRequest { + private String organization; + private String permission; + private String groupId; + private String groupName; + private String templateId; + private String templateName; + + public String getPermission() { + return permission; + } + + public RemoveGroupFromTemplateRequest setPermission(String permission) { + this.permission = requireNonNull(permission); + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public RemoveGroupFromTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getGroupId() { + return groupId; + } + + public RemoveGroupFromTemplateRequest setGroupId(@Nullable String groupId) { + this.groupId = groupId; + return this; + } + + @CheckForNull + public String getGroupName() { + return groupName; + } + + public RemoveGroupFromTemplateRequest setGroupName(@Nullable String groupName) { + this.groupName = groupName; + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public RemoveGroupFromTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public RemoveGroupFromTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateWsRequest.java deleted file mode 100644 index 91e4815106c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateWsRequest.java +++ /dev/null @@ -1,93 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveGroupFromTemplateWsRequest { - private String organization; - private String permission; - private String groupId; - private String groupName; - private String templateId; - private String templateName; - - public String getPermission() { - return permission; - } - - public RemoveGroupFromTemplateWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveGroupFromTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public RemoveGroupFromTemplateWsRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public RemoveGroupFromTemplateWsRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public RemoveGroupFromTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public RemoveGroupFromTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java new file mode 100644 index 00000000000..290d3288305 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java @@ -0,0 +1,91 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class RemoveGroupRequest { + private String organization; + private String groupId; + private String groupName; + private String permission; + private String projectId; + private String projectKey; + + @CheckForNull + public String getOrganization() { + return organization; + } + + public RemoveGroupRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getGroupId() { + return groupId; + } + + public RemoveGroupRequest setGroupId(@Nullable String groupId) { + this.groupId = groupId; + return this; + } + + @CheckForNull + public String getGroupName() { + return groupName; + } + + public RemoveGroupRequest setGroupName(@Nullable String groupName) { + this.groupName = groupName; + return this; + } + + public String getPermission() { + return permission; + } + + public RemoveGroupRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public RemoveGroupRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public RemoveGroupRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupWsRequest.java deleted file mode 100644 index 0a7930a6ef0..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupWsRequest.java +++ /dev/null @@ -1,91 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class RemoveGroupWsRequest { - private String organization; - private String groupId; - private String groupName; - private String permission; - private String projectId; - private String projectKey; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveGroupWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public RemoveGroupWsRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public RemoveGroupWsRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - public String getPermission() { - return permission; - } - - public RemoveGroupWsRequest setPermission(String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public RemoveGroupWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public RemoveGroupWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.java new file mode 100644 index 00000000000..49101053a82 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +import static java.util.Objects.requireNonNull; + +@Immutable +public class RemoveProjectCreatorFromTemplateRequest { + private final String templateId; + private final String organization; + private final String templateName; + private final String permission; + + private RemoveProjectCreatorFromTemplateRequest(Builder builder) { + this.templateId = builder.templateId; + this.organization = builder.organization; + this.templateName = builder.templateName; + this.permission = requireNonNull(builder.permission); + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public String getPermission() { + return permission; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String templateId; + private String organization; + private String templateName; + private String permission; + + private Builder() { + // enforce method constructor + } + + public Builder setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + public Builder setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + public Builder setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } + + public Builder setPermission(@Nullable String permission) { + this.permission = permission; + return this; + } + + public RemoveProjectCreatorFromTemplateRequest build() { + return new RemoveProjectCreatorFromTemplateRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateWsRequest.java deleted file mode 100644 index f5ee935b80a..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateWsRequest.java +++ /dev/null @@ -1,99 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static java.util.Objects.requireNonNull; - -@Immutable -public class RemoveProjectCreatorFromTemplateWsRequest { - private final String templateId; - private final String organization; - private final String templateName; - private final String permission; - - private RemoveProjectCreatorFromTemplateWsRequest(Builder builder) { - this.templateId = builder.templateId; - this.organization = builder.organization; - this.templateName = builder.templateName; - this.permission = requireNonNull(builder.permission); - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public String getPermission() { - return permission; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String templateId; - private String organization; - private String templateName; - private String permission; - - private Builder() { - // enforce method constructor - } - - public Builder setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - public Builder setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - public Builder setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - public Builder setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - public RemoveProjectCreatorFromTemplateWsRequest build() { - return new RemoveProjectCreatorFromTemplateWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.java new file mode 100644 index 00000000000..4db6cc28eed --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class RemoveUserFromTemplateRequest { + private String login; + private String permission; + private String templateId; + private String organization; + private String templateName; + + public String getLogin() { + return login; + } + + public RemoveUserFromTemplateRequest setLogin(String login) { + this.login = requireNonNull(login); + return this; + } + + public String getPermission() { + return permission; + } + + public RemoveUserFromTemplateRequest setPermission(String permission) { + this.permission = requireNonNull(permission); + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public RemoveUserFromTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public RemoveUserFromTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public RemoveUserFromTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java deleted file mode 100644 index 42a5fb89d2e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java +++ /dev/null @@ -1,81 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveUserFromTemplateWsRequest { - private String login; - private String permission; - private String templateId; - private String organization; - private String templateName; - - public String getLogin() { - return login; - } - - public RemoveUserFromTemplateWsRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - public String getPermission() { - return permission; - } - - public RemoveUserFromTemplateWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public RemoveUserFromTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveUserFromTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public RemoveUserFromTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java new file mode 100644 index 00000000000..8e92b49fd78 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class RemoveUserRequest { + private String permission; + private String login; + private String projectId; + private String projectKey; + + public String getPermission() { + return permission; + } + + public RemoveUserRequest setPermission(String permission) { + this.permission = requireNonNull(permission); + return this; + } + + public String getLogin() { + return login; + } + + public RemoveUserRequest setLogin(String login) { + this.login = requireNonNull(login); + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public RemoveUserRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public RemoveUserRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java deleted file mode 100644 index 2cd59a806b1..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java +++ /dev/null @@ -1,70 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveUserWsRequest { - private String permission; - private String login; - private String projectId; - private String projectKey; - - public String getPermission() { - return permission; - } - - public RemoveUserWsRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - public String getLogin() { - return login; - } - - public RemoveUserWsRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public RemoveUserWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public RemoveUserWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.java new file mode 100644 index 00000000000..770dcbfe886 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchProjectPermissionsRequest { + private String projectId; + private String projectKey; + private String qualifier; + private Integer page; + private Integer pageSize; + private String query; + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public SearchProjectPermissionsRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public SearchProjectPermissionsRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public SearchProjectPermissionsRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public SearchProjectPermissionsRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchProjectPermissionsRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public String getQualifier() { + return qualifier; + } + + public SearchProjectPermissionsRequest setQualifier(@Nullable String qualifier) { + this.qualifier = qualifier; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java deleted file mode 100644 index e1f0d0c1f5e..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java +++ /dev/null @@ -1,92 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchProjectPermissionsWsRequest { - private String projectId; - private String projectKey; - private String qualifier; - private Integer page; - private Integer pageSize; - private String query; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public SearchProjectPermissionsWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public SearchProjectPermissionsWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchProjectPermissionsWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchProjectPermissionsWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchProjectPermissionsWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public String getQualifier() { - return qualifier; - } - - public SearchProjectPermissionsWsRequest setQualifier(@Nullable String qualifier) { - this.qualifier = qualifier; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java new file mode 100644 index 00000000000..33cf11ba2ad --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java @@ -0,0 +1,47 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchTemplatesRequest { + private String query; + private String organizationUuid; + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchTemplatesRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + public String getOrganizationUuid() { + return organizationUuid; + } + + public SearchTemplatesRequest setOrganizationUuid(String s) { + this.organizationUuid = s; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java deleted file mode 100644 index 05587a043ed..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java +++ /dev/null @@ -1,47 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchTemplatesWsRequest { - private String query; - private String organizationUuid; - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchTemplatesWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - public String getOrganizationUuid() { - return organizationUuid; - } - - public SearchTemplatesWsRequest setOrganizationUuid(String s) { - this.organizationUuid = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java new file mode 100644 index 00000000000..14f6aae40c5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SetDefaultTemplateRequest { + private String qualifier; + private String templateId; + private String organization; + private String templateName; + + @CheckForNull + public String getQualifier() { + return qualifier; + } + + public SetDefaultTemplateRequest setQualifier(@Nullable String qualifier) { + this.qualifier = qualifier; + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public SetDefaultTemplateRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public SetDefaultTemplateRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public SetDefaultTemplateRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateWsRequest.java deleted file mode 100644 index 7f4a052f8d9..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateWsRequest.java +++ /dev/null @@ -1,70 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SetDefaultTemplateWsRequest { - private String qualifier; - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getQualifier() { - return qualifier; - } - - public SetDefaultTemplateWsRequest setQualifier(@Nullable String qualifier) { - this.qualifier = qualifier; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public SetDefaultTemplateWsRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public SetDefaultTemplateWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public SetDefaultTemplateWsRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.java new file mode 100644 index 00000000000..931af149676 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class UpdateTemplateRequest { + private String id; + private String description; + private String name; + private String projectKeyPattern; + + public String getId() { + return id; + } + + public UpdateTemplateRequest setId(String id) { + this.id = requireNonNull(id); + return this; + } + + @CheckForNull + public String getDescription() { + return description; + } + + public UpdateTemplateRequest setDescription(@Nullable String description) { + this.description = description; + return this; + } + + @CheckForNull + public String getName() { + return name; + } + + public UpdateTemplateRequest setName(@Nullable String name) { + this.name = name; + return this; + } + + @CheckForNull + public String getProjectKeyPattern() { + return projectKeyPattern; + } + + public UpdateTemplateRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateWsRequest.java deleted file mode 100644 index a378464097d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateWsRequest.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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class UpdateTemplateWsRequest { - private String id; - private String description; - private String name; - private String projectKeyPattern; - - public String getId() { - return id; - } - - public UpdateTemplateWsRequest setId(String id) { - this.id = requireNonNull(id); - return this; - } - - @CheckForNull - public String getDescription() { - return description; - } - - public UpdateTemplateWsRequest setDescription(@Nullable String description) { - this.description = description; - return this; - } - - @CheckForNull - public String getName() { - return name; - } - - public UpdateTemplateWsRequest setName(@Nullable String name) { - this.name = name; - return this; - } - - @CheckForNull - public String getProjectKeyPattern() { - return projectKeyPattern; - } - - public UpdateTemplateWsRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { - this.projectKeyPattern = projectKeyPattern; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.java new file mode 100644 index 00000000000..08e4168b722 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class UsersRequest { + private String organization; + private String permission; + private String projectId; + private String projectKey; + private String query; + private Integer page; + private Integer pageSize; + + @CheckForNull + public String getOrganization() { + return organization; + } + + public UsersRequest setOrganization(@Nullable String s) { + this.organization = s; + return this; + } + + @CheckForNull + public String getPermission() { + return permission; + } + + public UsersRequest setPermission(@Nullable String permission) { + this.permission = permission; + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public UsersRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public UsersRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public UsersRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + public UsersRequest setPage(int page) { + this.page = page; + return this; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + public UsersRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersWsRequest.java deleted file mode 100644 index 930178e1293..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersWsRequest.java +++ /dev/null @@ -1,103 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class UsersWsRequest { - private String organization; - private String permission; - private String projectId; - private String projectKey; - private String query; - private Integer page; - private Integer pageSize; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public UsersWsRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getPermission() { - return permission; - } - - public UsersWsRequest setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public UsersWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public UsersWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public UsersWsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public UsersWsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public UsersWsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.java new file mode 100644 index 00000000000..980f6361f87 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.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.project; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +import static com.google.common.base.Preconditions.checkArgument; + +@Immutable +public class BulkUpdateKeyRequest { + private final String id; + private final String key; + private final String from; + private final String to; + private final boolean dryRun; + + public BulkUpdateKeyRequest(Builder builder) { + this.id = builder.id; + this.key = builder.key; + this.from = builder.from; + this.to = builder.to; + this.dryRun = builder.dryRun; + } + + @CheckForNull + public String getId() { + return id; + } + + @CheckForNull + public String getKey() { + return key; + } + + public String getFrom() { + return from; + } + + public String getTo() { + return to; + } + + public boolean isDryRun() { + return dryRun; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String id; + private String key; + private String from; + private String to; + private boolean dryRun; + + private Builder() { + // enforce method constructor + } + + public Builder setId(@Nullable String id) { + this.id = id; + return this; + } + + public Builder setKey(@Nullable String key) { + this.key = key; + return this; + } + + public Builder setFrom(String from) { + this.from = from; + return this; + } + + public Builder setTo(String to) { + this.to = to; + return this; + } + + public Builder setDryRun(boolean dryRun) { + this.dryRun = dryRun; + return this; + } + + public BulkUpdateKeyRequest build() { + checkArgument(from != null && !from.isEmpty(), "The string to match must not be empty"); + checkArgument(to != null && !to.isEmpty(), "The string replacement must not be empty"); + return new BulkUpdateKeyRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java deleted file mode 100644 index 41a72f3e6c9..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java +++ /dev/null @@ -1,113 +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.project; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static com.google.common.base.Preconditions.checkArgument; - -@Immutable -public class BulkUpdateKeyWsRequest { - private final String id; - private final String key; - private final String from; - private final String to; - private final boolean dryRun; - - public BulkUpdateKeyWsRequest(Builder builder) { - this.id = builder.id; - this.key = builder.key; - this.from = builder.from; - this.to = builder.to; - this.dryRun = builder.dryRun; - } - - @CheckForNull - public String getId() { - return id; - } - - @CheckForNull - public String getKey() { - return key; - } - - public String getFrom() { - return from; - } - - public String getTo() { - return to; - } - - public boolean isDryRun() { - return dryRun; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String key; - private String from; - private String to; - private boolean dryRun; - - private Builder() { - // enforce method constructor - } - - public Builder setId(@Nullable String id) { - this.id = id; - return this; - } - - public Builder setKey(@Nullable String key) { - this.key = key; - return this; - } - - public Builder setFrom(String from) { - this.from = from; - return this; - } - - public Builder setTo(String to) { - this.to = to; - return this; - } - - public Builder setDryRun(boolean dryRun) { - this.dryRun = dryRun; - return this; - } - - public BulkUpdateKeyWsRequest build() { - checkArgument(from != null && !from.isEmpty(), "The string to match must not be empty"); - checkArgument(to != null && !to.isEmpty(), "The string replacement must not be empty"); - return new BulkUpdateKeyWsRequest(this); - } - } -} 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 9a42c155add..e169f4f96e1 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 @@ -85,7 +85,7 @@ public class ProjectsService extends BaseService { .setParam("project", request.getKey())); } - public void bulkDelete(SearchWsRequest request) { + public void bulkDelete(SearchRequest request) { PostRequest post = new PostRequest(path("bulk_delete")) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers())) @@ -98,7 +98,7 @@ public class ProjectsService extends BaseService { call(post); } - public void updateKey(UpdateKeyWsRequest request) { + public void updateKey(UpdateKeyRequest request) { PostRequest post = new PostRequest(path(ACTION_UPDATE_KEY)) .setParam(PARAM_PROJECT_ID, request.getId()) .setParam(PARAM_FROM, request.getKey()) @@ -107,7 +107,7 @@ public class ProjectsService extends BaseService { call(post); } - public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyWsRequest request) { + public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyRequest request) { PostRequest post = new PostRequest(path(ACTION_BULK_UPDATE_KEY)) .setParam(PARAM_PROJECT_ID, request.getId()) .setParam(PARAM_PROJECT, request.getKey()) @@ -117,7 +117,7 @@ public class ProjectsService extends BaseService { return call(post, BulkUpdateKeyWsResponse.parser()); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { GetRequest get = new GetRequest(path(ACTION_SEARCH)) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(request.getQualifiers())) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java new file mode 100644 index 00000000000..5cf2b559dc9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java @@ -0,0 +1,179 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.project; + +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.sonar.api.resources.Qualifiers; + +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Collections.singletonList; +import static java.util.Objects.requireNonNull; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE; + +public class SearchRequest { + + private final String organization; + private final String query; + private final List qualifiers; + private final String visibility; + private final Integer page; + private final Integer pageSize; + private final String analyzedBefore; + private final boolean onProvisionedOnly; + private final List projects; + private final List projectIds; + + public SearchRequest(Builder builder) { + this.organization = builder.organization; + this.query = builder.query; + this.qualifiers = builder.qualifiers; + this.visibility = builder.visibility; + this.page = builder.page; + this.pageSize = builder.pageSize; + this.analyzedBefore = builder.analyzedBefore; + this.onProvisionedOnly = builder.onProvisionedOnly; + this.projects = builder.projects; + this.projectIds = builder.projectIds; + } + + @CheckForNull + public String getOrganization() { + return organization; + } + + public List getQualifiers() { + return qualifiers; + } + + @CheckForNull + public Integer getPage() { + return page; + } + + @CheckForNull + public Integer getPageSize() { + return pageSize; + } + + @CheckForNull + public String getQuery() { + return query; + } + + @CheckForNull + public String getVisibility() { + return visibility; + } + + @CheckForNull + public String getAnalyzedBefore() { + return analyzedBefore; + } + + public boolean isOnProvisionedOnly() { + return onProvisionedOnly; + } + + @CheckForNull + public List getProjects() { + return projects; + } + + @CheckForNull + public List getProjectIds() { + return projectIds; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String organization; + private List qualifiers = singletonList(Qualifiers.PROJECT); + private Integer page; + private Integer pageSize; + private String query; + private String visibility; + private String analyzedBefore; + private boolean onProvisionedOnly = false; + private List projects; + private List projectIds; + + public Builder setOrganization(@Nullable String organization) { + this.organization = organization; + return this; + } + + public Builder setQualifiers(List qualifiers) { + this.qualifiers = requireNonNull(qualifiers, "Qualifiers cannot be null"); + return this; + } + + public Builder setPage(@Nullable Integer page) { + this.page = page; + return this; + } + + public Builder setPageSize(@Nullable Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + public Builder setQuery(@Nullable String query) { + this.query = query; + return this; + } + + public Builder setVisibility(@Nullable String visibility) { + this.visibility = visibility; + return this; + } + + public Builder setAnalyzedBefore(@Nullable String lastAnalysisBefore) { + this.analyzedBefore = lastAnalysisBefore; + return this; + } + + public Builder setOnProvisionedOnly(boolean onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public Builder setProjects(@Nullable List projects) { + this.projects = projects; + return this; + } + + public Builder setProjectIds(@Nullable List projectIds) { + this.projectIds = projectIds; + return this; + } + + public SearchRequest build() { + checkArgument(projects==null || !projects.isEmpty(), "Project key list must not be empty"); + checkArgument(projectIds==null || !projectIds.isEmpty(), "Project id list must not be empty"); + checkArgument(pageSize == null || pageSize <= MAX_PAGE_SIZE, "Page size must not be greater than %s", MAX_PAGE_SIZE); + return new SearchRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchWsRequest.java deleted file mode 100644 index 90544b37fc2..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchWsRequest.java +++ /dev/null @@ -1,179 +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.project; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.resources.Qualifiers; - -import static com.google.common.base.Preconditions.checkArgument; -import static java.util.Collections.singletonList; -import static java.util.Objects.requireNonNull; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE; - -public class SearchWsRequest { - - private final String organization; - private final String query; - private final List qualifiers; - private final String visibility; - private final Integer page; - private final Integer pageSize; - private final String analyzedBefore; - private final boolean onProvisionedOnly; - private final List projects; - private final List projectIds; - - public SearchWsRequest(Builder builder) { - this.organization = builder.organization; - this.query = builder.query; - this.qualifiers = builder.qualifiers; - this.visibility = builder.visibility; - this.page = builder.page; - this.pageSize = builder.pageSize; - this.analyzedBefore = builder.analyzedBefore; - this.onProvisionedOnly = builder.onProvisionedOnly; - this.projects = builder.projects; - this.projectIds = builder.projectIds; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public List getQualifiers() { - return qualifiers; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - @CheckForNull - public String getQuery() { - return query; - } - - @CheckForNull - public String getVisibility() { - return visibility; - } - - @CheckForNull - public String getAnalyzedBefore() { - return analyzedBefore; - } - - public boolean isOnProvisionedOnly() { - return onProvisionedOnly; - } - - @CheckForNull - public List getProjects() { - return projects; - } - - @CheckForNull - public List getProjectIds() { - return projectIds; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String organization; - private List qualifiers = singletonList(Qualifiers.PROJECT); - private Integer page; - private Integer pageSize; - private String query; - private String visibility; - private String analyzedBefore; - private boolean onProvisionedOnly = false; - private List projects; - private List projectIds; - - public Builder setOrganization(@Nullable String organization) { - this.organization = organization; - return this; - } - - public Builder setQualifiers(List qualifiers) { - this.qualifiers = requireNonNull(qualifiers, "Qualifiers cannot be null"); - return this; - } - - public Builder setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - public Builder setPageSize(@Nullable Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - public Builder setQuery(@Nullable String query) { - this.query = query; - return this; - } - - public Builder setVisibility(@Nullable String visibility) { - this.visibility = visibility; - return this; - } - - public Builder setAnalyzedBefore(@Nullable String lastAnalysisBefore) { - this.analyzedBefore = lastAnalysisBefore; - return this; - } - - public Builder setOnProvisionedOnly(boolean onProvisionedOnly) { - this.onProvisionedOnly = onProvisionedOnly; - return this; - } - - public Builder setProjects(@Nullable List projects) { - this.projects = projects; - return this; - } - - public Builder setProjectIds(@Nullable List projectIds) { - this.projectIds = projectIds; - return this; - } - - public SearchWsRequest build() { - checkArgument(projects==null || !projects.isEmpty(), "Project key list must not be empty"); - checkArgument(projectIds==null || !projectIds.isEmpty(), "Project id list must not be empty"); - checkArgument(pageSize == null || pageSize <= MAX_PAGE_SIZE, "Page size must not be greater than %s", MAX_PAGE_SIZE); - return new SearchWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java new file mode 100644 index 00000000000..0995a388c24 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java @@ -0,0 +1,88 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonarqube.ws.client.project; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.Immutable; + +import static com.google.common.base.Preconditions.checkArgument; + +@Immutable +public class UpdateKeyRequest { + private final String id; + private final String key; + private final String newKey; + + public UpdateKeyRequest(Builder builder) { + this.id = builder.id; + this.key = builder.key; + this.newKey = builder.newKey; + } + + @CheckForNull + public String getId() { + return id; + } + + @CheckForNull + public String getKey() { + return key; + } + + public String getNewKey() { + return newKey; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String id; + private String key; + private String newKey; + + private Builder() { + // enforce method constructor + } + + public Builder setId(@Nullable String id) { + this.id = id; + return this; + } + + public Builder setKey(@Nullable String key) { + this.key = key; + return this; + } + + public Builder setNewKey(String newKey) { + this.newKey = newKey; + return this; + } + + public UpdateKeyRequest build() { + checkArgument(newKey != null && !newKey.isEmpty(), "The new key must not be empty"); + return new UpdateKeyRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java deleted file mode 100644 index 206cb827cc2..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java +++ /dev/null @@ -1,88 +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.project; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static com.google.common.base.Preconditions.checkArgument; - -@Immutable -public class UpdateKeyWsRequest { - private final String id; - private final String key; - private final String newKey; - - public UpdateKeyWsRequest(Builder builder) { - this.id = builder.id; - this.key = builder.key; - this.newKey = builder.newKey; - } - - @CheckForNull - public String getId() { - return id; - } - - @CheckForNull - public String getKey() { - return key; - } - - public String getNewKey() { - return newKey; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String key; - private String newKey; - - private Builder() { - // enforce method constructor - } - - public Builder setId(@Nullable String id) { - this.id = id; - return this; - } - - public Builder setKey(@Nullable String key) { - this.key = key; - return this; - } - - public Builder setNewKey(String newKey) { - this.newKey = newKey; - return this; - } - - public UpdateKeyWsRequest build() { - checkArgument(newKey != null && !newKey.isEmpty(), "The new key must not be empty"); - return new UpdateKeyWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleRequest.java new file mode 100644 index 00000000000..70499d87f41 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleRequest.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.qualityprofile; + +import java.util.Optional; +import javax.annotation.Nullable; +import org.sonarqube.ws.Common.Severity; + +import static java.util.Objects.requireNonNull; + +public class ActivateRuleRequest { + private final Optional params; + private final String key; + private final Optional reset; + private final String ruleKey; + private final Optional severity; + private final Optional organization; + + private ActivateRuleRequest(Builder builder) { + organization = requireNonNull(builder.organization); + params = requireNonNull(builder.params); + key = requireNonNull(builder.key); + reset = requireNonNull(builder.reset); + ruleKey = requireNonNull(builder.ruleKey); + severity = requireNonNull(builder.severity); + } + + public static ActivateRuleRequest.Builder builder() { + return new Builder(); + } + + public Optional getParams() { + return params; + } + + public String getKey() { + return key; + } + + public Optional getReset() { + return reset; + } + + public String getRuleKey() { + return ruleKey; + } + + public Optional getSeverity() { + return severity; + } + + public Optional getOrganization() { + return organization; + } + + public static class Builder { + private Optional organization = Optional.empty(); + private Optional params = Optional.empty(); + private String key; + private Optional reset = Optional.empty(); + private String ruleKey; + private Optional severity = Optional.empty(); + + private Builder() { + } + + public Builder setOrganization(@Nullable String organization) { + this.organization = Optional.ofNullable(organization); + return this; + } + + public Builder setParams(@Nullable String params) { + this.params = Optional.ofNullable(params); + return this; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Builder setReset(@Nullable Boolean reset) { + this.reset = Optional.ofNullable(reset); + return this; + } + + public Builder setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public Builder setSeverity(@Nullable Severity severity) { + this.severity = Optional.ofNullable(severity); + return this; + } + + public ActivateRuleRequest build() { + return new ActivateRuleRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleWsRequest.java deleted file mode 100644 index e98b2b396e2..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleWsRequest.java +++ /dev/null @@ -1,118 +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.qualityprofile; - -import java.util.Optional; -import javax.annotation.Nullable; -import org.sonarqube.ws.Common.Severity; - -import static java.util.Objects.requireNonNull; - -public class ActivateRuleWsRequest { - private final Optional params; - private final String key; - private final Optional reset; - private final String ruleKey; - private final Optional severity; - private final Optional organization; - - private ActivateRuleWsRequest(Builder builder) { - organization = requireNonNull(builder.organization); - params = requireNonNull(builder.params); - key = requireNonNull(builder.key); - reset = requireNonNull(builder.reset); - ruleKey = requireNonNull(builder.ruleKey); - severity = requireNonNull(builder.severity); - } - - public static ActivateRuleWsRequest.Builder builder() { - return new Builder(); - } - - public Optional getParams() { - return params; - } - - public String getKey() { - return key; - } - - public Optional getReset() { - return reset; - } - - public String getRuleKey() { - return ruleKey; - } - - public Optional getSeverity() { - return severity; - } - - public Optional getOrganization() { - return organization; - } - - public static class Builder { - private Optional organization = Optional.empty(); - private Optional params = Optional.empty(); - private String key; - private Optional reset = Optional.empty(); - private String ruleKey; - private Optional severity = Optional.empty(); - - private Builder() { - } - - public Builder setOrganization(@Nullable String organization) { - this.organization = Optional.ofNullable(organization); - return this; - } - - public Builder setParams(@Nullable String params) { - this.params = Optional.ofNullable(params); - return this; - } - - public Builder setKey(String key) { - this.key = key; - return this; - } - - public Builder setReset(@Nullable Boolean reset) { - this.reset = Optional.ofNullable(reset); - return this; - } - - public Builder setRuleKey(String ruleKey) { - this.ruleKey = ruleKey; - return this; - } - - public Builder setSeverity(@Nullable Severity severity) { - this.severity = Optional.ofNullable(severity); - return this; - } - - public ActivateRuleWsRequest build() { - return new ActivateRuleWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogRequest.java new file mode 100644 index 00000000000..5c74416c9bc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogRequest.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.qualityprofile; + +public class ChangelogRequest { + + private final String language; + private final String organization; + private final Integer p; + private final Integer ps; + private final String qualityProfile; + private final String since; + private final String to; + + private ChangelogRequest(Builder builder) { + this.language = builder.language; + this.organization = builder.organization; + this.p = builder.p; + this.ps = builder.ps; + this.qualityProfile = builder.qualityProfile; + this.since = builder.since; + this.to = builder.to; + } + + public String getLanguage() { + return language; + } + + public String getOrganization() { + return organization; + } + + public Integer getP() { + return p; + } + + public Integer getPs() { + return ps; + } + + public String getQualityProfile() { + return qualityProfile; + } + + public String getSince() { + return since; + } + + public String getTo() { + return to; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String language; + private String organization; + private Integer p; + private Integer ps; + private String qualityProfile; + private String since; + private String to; + + private Builder() { + } + + public Builder setLanguage(String language) { + this.language = language; + return this; + } + + public Builder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public Builder setP(Integer p) { + this.p = p; + return this; + } + + public Builder setPs(Integer ps) { + this.ps = ps; + return this; + } + + public Builder setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public Builder setSince(String since) { + this.since = since; + return this; + } + + public Builder setTo(String to) { + this.to = to; + return this; + } + + public ChangelogRequest build() { + return new ChangelogRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.java deleted file mode 100644 index d47024682a9..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.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.qualityprofile; - -public class ChangelogWsRequest { - - private final String language; - private final String organization; - private final Integer p; - private final Integer ps; - private final String qualityProfile; - private final String since; - private final String to; - - private ChangelogWsRequest(Builder builder) { - this.language = builder.language; - this.organization = builder.organization; - this.p = builder.p; - this.ps = builder.ps; - this.qualityProfile = builder.qualityProfile; - this.since = builder.since; - this.to = builder.to; - } - - public String getLanguage() { - return language; - } - - public String getOrganization() { - return organization; - } - - public Integer getP() { - return p; - } - - public Integer getPs() { - return ps; - } - - public String getQualityProfile() { - return qualityProfile; - } - - public String getSince() { - return since; - } - - public String getTo() { - return to; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String language; - private String organization; - private Integer p; - private Integer ps; - private String qualityProfile; - private String since; - private String to; - - private Builder() { - } - - public Builder setLanguage(String language) { - this.language = language; - return this; - } - - public Builder setOrganization(String organization) { - this.organization = organization; - return this; - } - - public Builder setP(Integer p) { - this.p = p; - return this; - } - - public Builder setPs(Integer ps) { - this.ps = ps; - return this; - } - - public Builder setQualityProfile(String qualityProfile) { - this.qualityProfile = qualityProfile; - return this; - } - - public Builder setSince(String since) { - this.since = since; - return this; - } - - public Builder setTo(String to) { - this.to = to; - return this; - } - - public ChangelogWsRequest build() { - return new ChangelogWsRequest(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 30d6141fa5d..45451c61de2 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 @@ -82,7 +82,7 @@ public class QualityProfilesService extends BaseService { super(wsConnector, CONTROLLER_QUALITY_PROFILES); } - public void activateRule(ActivateRuleWsRequest request) { + public void activateRule(ActivateRuleRequest request) { PostRequest httpRequest = new PostRequest(path(ACTION_ACTIVATE_RULE)); httpRequest.setParam(PARAM_ORGANIZATION, request.getOrganization().orElse(null)); httpRequest.setParam(PARAM_PARAMS, request.getParams().orElse(null)); @@ -100,14 +100,14 @@ public class QualityProfilesService extends BaseService { call(httpRequest); } - public void restoreProfile(RestoreWsRequest request) { + public void restoreProfile(RestoreRequest request) { PostRequest httpRequest = new PostRequest(path(ACTION_RESTORE)); httpRequest.setParam(PARAM_ORGANIZATION, request.getOrganization().orElse(null)); httpRequest.setPart(PARAM_BACKUP, new PostRequest.Part(MediaTypes.XML, request.getBackup())); call(httpRequest); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { return call( new GetRequest(path(ACTION_SEARCH)) .setParam(PARAM_DEFAULTS, request.getDefaults()) @@ -243,7 +243,7 @@ public class QualityProfilesService extends BaseService { SearchGroupsResponse.parser()); } - public String changelog(ChangelogWsRequest request) { + public String changelog(ChangelogRequest request) { PostRequest postRequest = new PostRequest(path("changelog")) .setParam("language", request.getLanguage()) .setParam("organization", request.getOrganization()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreRequest.java new file mode 100644 index 00000000000..c4cbdaec421 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreRequest.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.qualityprofile; + +import java.io.File; +import java.util.Optional; +import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNull; + +public class RestoreRequest { + + private final File backup; + private final Optional organization; + + private RestoreRequest(Builder builder) { + backup = requireNonNull(builder.backup); + organization = requireNonNull(builder.organization); + } + + public File getBackup() { + return backup; + } + + public Optional getOrganization() { + return organization; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private File backup; + private Optional organization = Optional.empty(); + + public Builder setBackup(File backup) { + this.backup = backup; + return this; + } + + public Builder setOrganization(@Nullable String organization) { + this.organization = Optional.ofNullable(organization); + return this; + } + + public RestoreRequest build() { + return new RestoreRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreWsRequest.java deleted file mode 100644 index 908115d6822..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RestoreWsRequest.java +++ /dev/null @@ -1,68 +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.qualityprofile; - -import java.io.File; -import java.util.Optional; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RestoreWsRequest { - - private final File backup; - private final Optional organization; - - private RestoreWsRequest(Builder builder) { - backup = requireNonNull(builder.backup); - organization = requireNonNull(builder.organization); - } - - public File getBackup() { - return backup; - } - - public Optional getOrganization() { - return organization; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private File backup; - private Optional organization = Optional.empty(); - - public Builder setBackup(File backup) { - this.backup = backup; - return this; - } - - public Builder setOrganization(@Nullable String organization) { - this.organization = Optional.ofNullable(organization); - return this; - } - - public RestoreWsRequest build() { - return new RestoreWsRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchRequest.java new file mode 100644 index 00000000000..1df9c059e6a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchRequest.java @@ -0,0 +1,79 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.qualityprofile; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchRequest { + private String organizationKey; + private boolean defaults; + private String language; + private String qualityProfile; + private String projectKey; + + public String getOrganizationKey() { + return organizationKey; + } + + public SearchRequest setOrganizationKey(String organizationKey) { + this.organizationKey = organizationKey; + return this; + } + + public boolean getDefaults() { + return defaults; + } + + public SearchRequest setDefaults(boolean defaults) { + this.defaults = defaults; + return this; + } + + @CheckForNull + public String getLanguage() { + return language; + } + + public SearchRequest setLanguage(@Nullable String language) { + this.language = language; + return this; + } + + @CheckForNull + public String getQualityProfile() { + return qualityProfile; + } + + public SearchRequest setQualityProfile(@Nullable String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public SearchRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java deleted file mode 100644 index 7cf4b966993..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java +++ /dev/null @@ -1,79 +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.qualityprofile; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchWsRequest { - private String organizationKey; - private boolean defaults; - private String language; - private String qualityProfile; - private String projectKey; - - public String getOrganizationKey() { - return organizationKey; - } - - public SearchWsRequest setOrganizationKey(String organizationKey) { - this.organizationKey = organizationKey; - return this; - } - - public boolean getDefaults() { - return defaults; - } - - public SearchWsRequest setDefaults(boolean defaults) { - this.defaults = defaults; - return this; - } - - @CheckForNull - public String getLanguage() { - return language; - } - - public SearchWsRequest setLanguage(@Nullable String language) { - this.language = language; - return this; - } - - @CheckForNull - public String getQualityProfile() { - return qualityProfile; - } - - public SearchWsRequest setQualityProfile(@Nullable String qualityProfile) { - this.qualityProfile = qualityProfile; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public SearchWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} 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 5e6f3fa211a..86f01cbc370 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 @@ -93,7 +93,7 @@ public class ComponentsServiceTest { public void show() { String key = randomAlphanumeric(20); String id = randomAlphanumeric(20); - underTest.show(new ShowWsRequest() + underTest.show(new ShowRequest() .setKey(key) .setId(id) .setBranch("my_branch")); @@ -109,9 +109,9 @@ public class ComponentsServiceTest { @Test public void suggestions() { - SuggestionsWsRequest.More more = SuggestionsWsRequest.More.BRC; + SuggestionsRequest.More more = SuggestionsRequest.More.BRC; String s = randomAlphanumeric(20); - underTest.suggestions(SuggestionsWsRequest.builder() + underTest.suggestions(SuggestionsRequest.builder() .setMore(more) .setS(s) .setRecentlyBrowsed(asList("key-1", "key-2")) @@ -134,7 +134,7 @@ public class ComponentsServiceTest { int page = 17; int pageSize = 39; String textQuery = randomAlphanumeric(20); - underTest.search(new SearchWsRequest() + underTest.search(new SearchRequest() .setOrganization(organization) .setQualifiers(asList("q1", "q2")) .setPage(page) @@ -160,7 +160,7 @@ public class ComponentsServiceTest { int page = 17; int pageSize = 39; String query = randomAlphanumeric(20); - underTest.tree(new TreeWsRequest() + underTest.tree(new TreeRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) .setComponent(componentKey) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchRequestTest.java new file mode 100644 index 00000000000..b4228376693 --- /dev/null +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchRequestTest.java @@ -0,0 +1,588 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.issue; + +import com.google.common.collect.ImmutableList; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class SearchRequestTest { + private static final ImmutableList LIST_OF_STRINGS = ImmutableList.of("A", "B"); + private static final String SOME_STRING = "some string"; + public static final int SOME_INT = 894352; + + private SearchRequest underTest = new SearchRequest(); + + @Test + public void getActionPlans_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getActionPlans()).isNull(); + } + + @Test + public void setActionPlans_accepts_null() { + underTest.setActionPlans(null); + } + + @Test + public void getActionPlans_returns_object_from_setActionPlans() { + underTest.setActionPlans(LIST_OF_STRINGS); + + assertThat(underTest.getActionPlans()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getAdditionalFields_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getAdditionalFields()).isNull(); + } + + @Test + public void setAdditionalFields_accepts_null() { + underTest.setAdditionalFields(null); + } + + @Test + public void getAdditionalFields_returns_object_from_setAdditionalFields() { + underTest.setAdditionalFields(LIST_OF_STRINGS); + assertThat(underTest.getAdditionalFields()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getAssignees_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getAssignees()).isNull(); + } + + @Test + public void setAssignees_accepts_null() { + underTest.setAssignees(null); + } + + @Test + public void getAssignees_returns_object_from_setAssignees() { + underTest.setAssignees(LIST_OF_STRINGS); + assertThat(underTest.getAssignees()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getAuthors_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getAuthors()).isNull(); + } + + @Test + public void setAuthors_accepts_null() { + underTest.setAuthors(null); + } + + @Test + public void getAuthors_returns_object_from_setAuthors() { + underTest.setAuthors(LIST_OF_STRINGS); + assertThat(underTest.getAuthors()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getComponentKeys_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getComponentKeys()).isNull(); + } + + @Test + public void setComponentKeys_accepts_null() { + underTest.setComponentKeys(null); + } + + @Test + public void getComponentKeys_returns_object_from_setComponentKeys() { + underTest.setComponentKeys(LIST_OF_STRINGS); + assertThat(underTest.getComponentKeys()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getComponentRootUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getComponentRootUuids()).isNull(); + } + + @Test + public void setComponentRootUuids_accepts_null() { + underTest.setComponentRootUuids(null); + } + + @Test + public void getComponentRootUuids_returns_object_from_setComponentRootUuids() { + underTest.setComponentRootUuids(LIST_OF_STRINGS); + assertThat(underTest.getComponentRootUuids()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getComponentRoots_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getComponentRoots()).isNull(); + } + + @Test + public void setComponentRoots_accepts_null() { + underTest.setComponentRoots(null); + } + + @Test + public void getComponentRoots_returns_object_from_setComponentRoots() { + underTest.setComponentRoots(LIST_OF_STRINGS); + assertThat(underTest.getComponentRoots()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getComponentUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getComponentUuids()).isNull(); + } + + @Test + public void setComponentUuids_accepts_null() { + underTest.setComponentUuids(null); + } + + @Test + public void getComponentUuids_returns_object_from_setComponentUuids() { + underTest.setComponentUuids(LIST_OF_STRINGS); + assertThat(underTest.getComponentUuids()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getComponents_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getComponents()).isNull(); + } + + @Test + public void setComponents_accepts_null() { + underTest.setComponents(null); + } + + @Test + public void getComponents_returns_object_from_setComponents() { + underTest.setComponents(LIST_OF_STRINGS); + assertThat(underTest.getComponents()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getDirectories_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getDirectories()).isNull(); + } + + @Test + public void setDirectories_accepts_null() { + underTest.setDirectories(null); + } + + @Test + public void getDirectories_returns_object_from_setDirectories() { + underTest.setDirectories(LIST_OF_STRINGS); + assertThat(underTest.getDirectories()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getFacets_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getFacets()).isNull(); + } + + @Test + public void setFacets_accepts_null() { + underTest.setFacets(null); + } + + @Test + public void getFacets_returns_object_from_setFacets() { + underTest.setFacets(LIST_OF_STRINGS); + assertThat(underTest.getFacets()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getFileUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getFileUuids()).isNull(); + } + + @Test + public void setFileUuids_accepts_null() { + underTest.setFileUuids(null); + } + + @Test + public void getFileUuids_returns_object_from_setFileUuids() { + underTest.setFileUuids(LIST_OF_STRINGS); + assertThat(underTest.getFileUuids()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getIssues_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getIssues()).isNull(); + } + + @Test + public void setIssues_accepts_null() { + underTest.setIssues(null); + } + + @Test + public void getIssues_returns_object_from_setIssues() { + underTest.setIssues(LIST_OF_STRINGS); + assertThat(underTest.getIssues()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getLanguages_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getLanguages()).isNull(); + } + + @Test + public void setLanguages_accepts_null() { + underTest.setLanguages(null); + } + + @Test + public void getLanguages_returns_object_from_setLanguages() { + underTest.setLanguages(LIST_OF_STRINGS); + assertThat(underTest.getLanguages()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getModuleUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getModuleUuids()).isNull(); + } + + @Test + public void setModuleUuids_accepts_null() { + underTest.setModuleUuids(null); + } + + @Test + public void getModuleUuids_returns_object_from_setModuleUuids() { + underTest.setModuleUuids(LIST_OF_STRINGS); + assertThat(underTest.getModuleUuids()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getProjectKeys_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getProjectKeys()).isNull(); + } + + @Test + public void setProjectKeys_accepts_null() { + underTest.setProjectKeys(null); + } + + @Test + public void getProjectKeys_returns_object_from_setProjectKeys() { + underTest.setProjectKeys(LIST_OF_STRINGS); + assertThat(underTest.getProjectKeys()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getProjectUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getProjectUuids()).isNull(); + } + + @Test + public void setProjectUuids_accepts_null() { + underTest.setProjectUuids(null); + } + + @Test + public void getProjectUuids_returns_object_from_setProjectUuids() { + underTest.setProjectUuids(LIST_OF_STRINGS); + assertThat(underTest.getProjectUuids()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getProjects_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getProjects()).isNull(); + } + + @Test + public void setProjects_accepts_null() { + underTest.setProjects(null); + } + + @Test + public void getProjects_returns_object_from_setProjects() { + underTest.setProjects(LIST_OF_STRINGS); + assertThat(underTest.getProjects()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getResolutions_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getResolutions()).isNull(); + } + + @Test + public void setResolutions_accepts_null() { + underTest.setResolutions(null); + } + + @Test + public void getResolutions_returns_object_from_setResolutions() { + underTest.setResolutions(LIST_OF_STRINGS); + assertThat(underTest.getResolutions()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getRules_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getRules()).isNull(); + } + + @Test + public void setRules_accepts_null() { + underTest.setRules(null); + } + + @Test + public void getRules_returns_object_from_setRules() { + underTest.setRules(LIST_OF_STRINGS); + assertThat(underTest.getRules()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getSeverities_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getSeverities()).isNull(); + } + + @Test + public void setSeverities_accepts_null() { + underTest.setSeverities(null); + } + + @Test + public void getSeverities_returns_object_from_setSeverities() { + underTest.setSeverities(LIST_OF_STRINGS); + assertThat(underTest.getSeverities()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getStatuses_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getStatuses()).isNull(); + } + + @Test + public void setStatuses_accepts_null() { + underTest.setStatuses(null); + } + + @Test + public void getStatuses_returns_object_from_setStatuses() { + underTest.setStatuses(LIST_OF_STRINGS); + assertThat(underTest.getStatuses()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getTags_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getTags()).isNull(); + } + + @Test + public void setTags_accepts_null() { + underTest.setTags(null); + } + + @Test + public void getTags_returns_object_from_setTags() { + underTest.setTags(LIST_OF_STRINGS); + assertThat(underTest.getTags()).isSameAs(LIST_OF_STRINGS); + } + + @Test + public void getAsc_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getAsc()).isNull(); + } + + @Test + public void getAsc_returns_boolean_from_setTags() { + underTest.setAsc(true); + assertThat(underTest.getAsc()).isTrue(); + underTest.setAsc(false); + assertThat(underTest.getAsc()).isFalse(); + } + + @Test + public void getAssigned_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getAssigned()).isNull(); + } + + @Test + public void setAssigned_accepts_null() { + underTest.setAssigned(null); + } + + @Test + public void getAssigned_returns_boolean_from_setTags() { + underTest.setAssigned(true); + assertThat(underTest.getAssigned()).isTrue(); + underTest.setAssigned(false); + assertThat(underTest.getAssigned()).isFalse(); + } + + @Test + public void getOnComponentOnly_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getOnComponentOnly()).isNull(); + } + + @Test + public void setOnComponentOnly_accepts_null() { + underTest.setOnComponentOnly(null); + } + + @Test + public void getOnComponentOnly_returns_boolean_from_setOnComponentOnly() { + underTest.setOnComponentOnly(true); + assertThat(underTest.getOnComponentOnly()).isTrue(); + underTest.setOnComponentOnly(false); + assertThat(underTest.getOnComponentOnly()).isFalse(); + } + + @Test + public void getResolved_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getResolved()).isNull(); + } + + @Test + public void setResolved_accepts_null() { + underTest.setResolved(null); + } + + @Test + public void getResolved_returns_boolean_from_setResolved() { + underTest.setResolved(true); + assertThat(underTest.getResolved()).isTrue(); + underTest.setResolved(false); + assertThat(underTest.getResolved()).isFalse(); + } + + @Test + public void getCreatedAfter_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getCreatedAfter()).isNull(); + } + + @Test + public void setCreatedAfter_accepts_null() { + underTest.setCreatedAfter(null); + } + + @Test + public void getCreatedAfter_returns_object_from_setCreatedAfter() { + underTest.setCreatedAfter(SOME_STRING); + assertThat(underTest.getCreatedAfter()).isEqualTo(SOME_STRING); + } + + @Test + public void getCreatedAt_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getCreatedAt()).isNull(); + } + + @Test + public void setCreatedAt_accepts_null() { + underTest.setCreatedAt(null); + } + + @Test + public void getCreatedAt_returns_object_from_setCreatedAt() { + underTest.setCreatedAt(SOME_STRING); + assertThat(underTest.getCreatedAt()).isEqualTo(SOME_STRING); + } + + @Test + public void getCreatedBefore_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getCreatedBefore()).isNull(); + } + + @Test + public void setCreatedBefore_accepts_null() { + underTest.setCreatedBefore(null); + } + + @Test + public void getCreatedBefore_returns_object_from_setCreatedBefore() { + underTest.setCreatedBefore(SOME_STRING); + assertThat(underTest.getCreatedBefore()).isEqualTo(SOME_STRING); + } + + @Test + public void getCreatedInLast_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getCreatedInLast()).isNull(); + } + + @Test + public void setCreatedInLast_accepts_null() { + underTest.setCreatedInLast(null); + } + + @Test + public void getCreatedInLast_returns_object_from_setCreatedInLast() { + underTest.setCreatedInLast(SOME_STRING); + assertThat(underTest.getCreatedInLast()).isEqualTo(SOME_STRING); + } + + @Test + public void getFacetMode_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getFacetMode()).isNull(); + } + + @Test + public void setFacetMode_accepts_null() { + underTest.setFacetMode(null); + } + + @Test + public void getFacetMode_returns_object_from_setFacetMode() { + underTest.setFacetMode(SOME_STRING); + assertThat(underTest.getFacetMode()).isEqualTo(SOME_STRING); + } + + @Test + public void getSort_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getSort()).isNull(); + } + + @Test + public void setSort_accepts_null() { + underTest.setSort(null); + } + + @Test + public void getSort_returns_object_from_setSort() { + underTest.setSort(SOME_STRING); + assertThat(underTest.getSort()).isEqualTo(SOME_STRING); + } + + @Test + public void getPage_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getPage()).isNull(); + } + + @Test + public void getPage_returns_object_from_setPage() { + underTest.setPage(SOME_INT); + assertThat(underTest.getPage()).isEqualTo(SOME_INT); + } + + @Test + public void getPageSize_returns_null_when_SearchWsRequest_has_just_been_instantiated() { + assertThat(underTest.getPageSize()).isNull(); + } + + @Test + public void getPageSize_returns_object_from_setPageSize() { + underTest.setPageSize(SOME_INT); + assertThat(underTest.getPageSize()).isEqualTo(SOME_INT); + } + +} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchWsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchWsRequestTest.java deleted file mode 100644 index 2d05fda7b92..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/issue/SearchWsRequestTest.java +++ /dev/null @@ -1,588 +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.issue; - -import com.google.common.collect.ImmutableList; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SearchWsRequestTest { - private static final ImmutableList LIST_OF_STRINGS = ImmutableList.of("A", "B"); - private static final String SOME_STRING = "some string"; - public static final int SOME_INT = 894352; - - private SearchWsRequest underTest = new SearchWsRequest(); - - @Test - public void getActionPlans_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getActionPlans()).isNull(); - } - - @Test - public void setActionPlans_accepts_null() { - underTest.setActionPlans(null); - } - - @Test - public void getActionPlans_returns_object_from_setActionPlans() { - underTest.setActionPlans(LIST_OF_STRINGS); - - assertThat(underTest.getActionPlans()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getAdditionalFields_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getAdditionalFields()).isNull(); - } - - @Test - public void setAdditionalFields_accepts_null() { - underTest.setAdditionalFields(null); - } - - @Test - public void getAdditionalFields_returns_object_from_setAdditionalFields() { - underTest.setAdditionalFields(LIST_OF_STRINGS); - assertThat(underTest.getAdditionalFields()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getAssignees_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getAssignees()).isNull(); - } - - @Test - public void setAssignees_accepts_null() { - underTest.setAssignees(null); - } - - @Test - public void getAssignees_returns_object_from_setAssignees() { - underTest.setAssignees(LIST_OF_STRINGS); - assertThat(underTest.getAssignees()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getAuthors_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getAuthors()).isNull(); - } - - @Test - public void setAuthors_accepts_null() { - underTest.setAuthors(null); - } - - @Test - public void getAuthors_returns_object_from_setAuthors() { - underTest.setAuthors(LIST_OF_STRINGS); - assertThat(underTest.getAuthors()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getComponentKeys_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getComponentKeys()).isNull(); - } - - @Test - public void setComponentKeys_accepts_null() { - underTest.setComponentKeys(null); - } - - @Test - public void getComponentKeys_returns_object_from_setComponentKeys() { - underTest.setComponentKeys(LIST_OF_STRINGS); - assertThat(underTest.getComponentKeys()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getComponentRootUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getComponentRootUuids()).isNull(); - } - - @Test - public void setComponentRootUuids_accepts_null() { - underTest.setComponentRootUuids(null); - } - - @Test - public void getComponentRootUuids_returns_object_from_setComponentRootUuids() { - underTest.setComponentRootUuids(LIST_OF_STRINGS); - assertThat(underTest.getComponentRootUuids()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getComponentRoots_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getComponentRoots()).isNull(); - } - - @Test - public void setComponentRoots_accepts_null() { - underTest.setComponentRoots(null); - } - - @Test - public void getComponentRoots_returns_object_from_setComponentRoots() { - underTest.setComponentRoots(LIST_OF_STRINGS); - assertThat(underTest.getComponentRoots()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getComponentUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getComponentUuids()).isNull(); - } - - @Test - public void setComponentUuids_accepts_null() { - underTest.setComponentUuids(null); - } - - @Test - public void getComponentUuids_returns_object_from_setComponentUuids() { - underTest.setComponentUuids(LIST_OF_STRINGS); - assertThat(underTest.getComponentUuids()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getComponents_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getComponents()).isNull(); - } - - @Test - public void setComponents_accepts_null() { - underTest.setComponents(null); - } - - @Test - public void getComponents_returns_object_from_setComponents() { - underTest.setComponents(LIST_OF_STRINGS); - assertThat(underTest.getComponents()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getDirectories_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getDirectories()).isNull(); - } - - @Test - public void setDirectories_accepts_null() { - underTest.setDirectories(null); - } - - @Test - public void getDirectories_returns_object_from_setDirectories() { - underTest.setDirectories(LIST_OF_STRINGS); - assertThat(underTest.getDirectories()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getFacets_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getFacets()).isNull(); - } - - @Test - public void setFacets_accepts_null() { - underTest.setFacets(null); - } - - @Test - public void getFacets_returns_object_from_setFacets() { - underTest.setFacets(LIST_OF_STRINGS); - assertThat(underTest.getFacets()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getFileUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getFileUuids()).isNull(); - } - - @Test - public void setFileUuids_accepts_null() { - underTest.setFileUuids(null); - } - - @Test - public void getFileUuids_returns_object_from_setFileUuids() { - underTest.setFileUuids(LIST_OF_STRINGS); - assertThat(underTest.getFileUuids()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getIssues_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getIssues()).isNull(); - } - - @Test - public void setIssues_accepts_null() { - underTest.setIssues(null); - } - - @Test - public void getIssues_returns_object_from_setIssues() { - underTest.setIssues(LIST_OF_STRINGS); - assertThat(underTest.getIssues()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getLanguages_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getLanguages()).isNull(); - } - - @Test - public void setLanguages_accepts_null() { - underTest.setLanguages(null); - } - - @Test - public void getLanguages_returns_object_from_setLanguages() { - underTest.setLanguages(LIST_OF_STRINGS); - assertThat(underTest.getLanguages()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getModuleUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getModuleUuids()).isNull(); - } - - @Test - public void setModuleUuids_accepts_null() { - underTest.setModuleUuids(null); - } - - @Test - public void getModuleUuids_returns_object_from_setModuleUuids() { - underTest.setModuleUuids(LIST_OF_STRINGS); - assertThat(underTest.getModuleUuids()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getProjectKeys_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getProjectKeys()).isNull(); - } - - @Test - public void setProjectKeys_accepts_null() { - underTest.setProjectKeys(null); - } - - @Test - public void getProjectKeys_returns_object_from_setProjectKeys() { - underTest.setProjectKeys(LIST_OF_STRINGS); - assertThat(underTest.getProjectKeys()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getProjectUuids_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getProjectUuids()).isNull(); - } - - @Test - public void setProjectUuids_accepts_null() { - underTest.setProjectUuids(null); - } - - @Test - public void getProjectUuids_returns_object_from_setProjectUuids() { - underTest.setProjectUuids(LIST_OF_STRINGS); - assertThat(underTest.getProjectUuids()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getProjects_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getProjects()).isNull(); - } - - @Test - public void setProjects_accepts_null() { - underTest.setProjects(null); - } - - @Test - public void getProjects_returns_object_from_setProjects() { - underTest.setProjects(LIST_OF_STRINGS); - assertThat(underTest.getProjects()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getResolutions_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getResolutions()).isNull(); - } - - @Test - public void setResolutions_accepts_null() { - underTest.setResolutions(null); - } - - @Test - public void getResolutions_returns_object_from_setResolutions() { - underTest.setResolutions(LIST_OF_STRINGS); - assertThat(underTest.getResolutions()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getRules_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getRules()).isNull(); - } - - @Test - public void setRules_accepts_null() { - underTest.setRules(null); - } - - @Test - public void getRules_returns_object_from_setRules() { - underTest.setRules(LIST_OF_STRINGS); - assertThat(underTest.getRules()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getSeverities_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getSeverities()).isNull(); - } - - @Test - public void setSeverities_accepts_null() { - underTest.setSeverities(null); - } - - @Test - public void getSeverities_returns_object_from_setSeverities() { - underTest.setSeverities(LIST_OF_STRINGS); - assertThat(underTest.getSeverities()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getStatuses_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getStatuses()).isNull(); - } - - @Test - public void setStatuses_accepts_null() { - underTest.setStatuses(null); - } - - @Test - public void getStatuses_returns_object_from_setStatuses() { - underTest.setStatuses(LIST_OF_STRINGS); - assertThat(underTest.getStatuses()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getTags_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getTags()).isNull(); - } - - @Test - public void setTags_accepts_null() { - underTest.setTags(null); - } - - @Test - public void getTags_returns_object_from_setTags() { - underTest.setTags(LIST_OF_STRINGS); - assertThat(underTest.getTags()).isSameAs(LIST_OF_STRINGS); - } - - @Test - public void getAsc_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getAsc()).isNull(); - } - - @Test - public void getAsc_returns_boolean_from_setTags() { - underTest.setAsc(true); - assertThat(underTest.getAsc()).isTrue(); - underTest.setAsc(false); - assertThat(underTest.getAsc()).isFalse(); - } - - @Test - public void getAssigned_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getAssigned()).isNull(); - } - - @Test - public void setAssigned_accepts_null() { - underTest.setAssigned(null); - } - - @Test - public void getAssigned_returns_boolean_from_setTags() { - underTest.setAssigned(true); - assertThat(underTest.getAssigned()).isTrue(); - underTest.setAssigned(false); - assertThat(underTest.getAssigned()).isFalse(); - } - - @Test - public void getOnComponentOnly_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getOnComponentOnly()).isNull(); - } - - @Test - public void setOnComponentOnly_accepts_null() { - underTest.setOnComponentOnly(null); - } - - @Test - public void getOnComponentOnly_returns_boolean_from_setOnComponentOnly() { - underTest.setOnComponentOnly(true); - assertThat(underTest.getOnComponentOnly()).isTrue(); - underTest.setOnComponentOnly(false); - assertThat(underTest.getOnComponentOnly()).isFalse(); - } - - @Test - public void getResolved_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getResolved()).isNull(); - } - - @Test - public void setResolved_accepts_null() { - underTest.setResolved(null); - } - - @Test - public void getResolved_returns_boolean_from_setResolved() { - underTest.setResolved(true); - assertThat(underTest.getResolved()).isTrue(); - underTest.setResolved(false); - assertThat(underTest.getResolved()).isFalse(); - } - - @Test - public void getCreatedAfter_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getCreatedAfter()).isNull(); - } - - @Test - public void setCreatedAfter_accepts_null() { - underTest.setCreatedAfter(null); - } - - @Test - public void getCreatedAfter_returns_object_from_setCreatedAfter() { - underTest.setCreatedAfter(SOME_STRING); - assertThat(underTest.getCreatedAfter()).isEqualTo(SOME_STRING); - } - - @Test - public void getCreatedAt_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getCreatedAt()).isNull(); - } - - @Test - public void setCreatedAt_accepts_null() { - underTest.setCreatedAt(null); - } - - @Test - public void getCreatedAt_returns_object_from_setCreatedAt() { - underTest.setCreatedAt(SOME_STRING); - assertThat(underTest.getCreatedAt()).isEqualTo(SOME_STRING); - } - - @Test - public void getCreatedBefore_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getCreatedBefore()).isNull(); - } - - @Test - public void setCreatedBefore_accepts_null() { - underTest.setCreatedBefore(null); - } - - @Test - public void getCreatedBefore_returns_object_from_setCreatedBefore() { - underTest.setCreatedBefore(SOME_STRING); - assertThat(underTest.getCreatedBefore()).isEqualTo(SOME_STRING); - } - - @Test - public void getCreatedInLast_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getCreatedInLast()).isNull(); - } - - @Test - public void setCreatedInLast_accepts_null() { - underTest.setCreatedInLast(null); - } - - @Test - public void getCreatedInLast_returns_object_from_setCreatedInLast() { - underTest.setCreatedInLast(SOME_STRING); - assertThat(underTest.getCreatedInLast()).isEqualTo(SOME_STRING); - } - - @Test - public void getFacetMode_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getFacetMode()).isNull(); - } - - @Test - public void setFacetMode_accepts_null() { - underTest.setFacetMode(null); - } - - @Test - public void getFacetMode_returns_object_from_setFacetMode() { - underTest.setFacetMode(SOME_STRING); - assertThat(underTest.getFacetMode()).isEqualTo(SOME_STRING); - } - - @Test - public void getSort_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getSort()).isNull(); - } - - @Test - public void setSort_accepts_null() { - underTest.setSort(null); - } - - @Test - public void getSort_returns_object_from_setSort() { - underTest.setSort(SOME_STRING); - assertThat(underTest.getSort()).isEqualTo(SOME_STRING); - } - - @Test - public void getPage_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getPage()).isNull(); - } - - @Test - public void getPage_returns_object_from_setPage() { - underTest.setPage(SOME_INT); - assertThat(underTest.getPage()).isEqualTo(SOME_INT); - } - - @Test - public void getPageSize_returns_null_when_SearchWsRequest_has_just_been_instantiated() { - assertThat(underTest.getPageSize()).isNull(); - } - - @Test - public void getPageSize_returns_object_from_setPageSize() { - underTest.setPageSize(SOME_INT); - assertThat(underTest.getPageSize()).isEqualTo(SOME_INT); - } - -} 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 653d79aba19..cfdc00f510c 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 @@ -81,7 +81,7 @@ public class MeasuresServiceTest { @Test public void component() { - ComponentWsRequest request = new ComponentWsRequest() + ComponentRequest request = new ComponentRequest() .setComponentId(VALUE_BASE_COMPONENT_ID) .setComponentKey(VALUE_BASE_COMPONENT_KEY) .setComponent(VALUE_BASE_COMPONENT_KEY) @@ -110,7 +110,7 @@ public class MeasuresServiceTest { @Test public void component_tree() { - ComponentTreeWsRequest componentTreeRequest = new ComponentTreeWsRequest() + ComponentTreeRequest componentTreeRequest = new ComponentTreeRequest() .setBaseComponentId(VALUE_BASE_COMPONENT_ID) .setBaseComponentKey(VALUE_BASE_COMPONENT_KEY) .setComponent(VALUE_BASE_COMPONENT_KEY) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java index aefc8a6411a..f15381affaa 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java @@ -39,7 +39,7 @@ public class OrganizationServiceTest { @Test public void search() { - underTest.search(SearchWsRequest.builder() + underTest.search(SearchRequest.builder() .setOrganizations("orga1", "orga2") .setPage(2) .setPageSize(10) @@ -56,7 +56,7 @@ public class OrganizationServiceTest { @Test public void search_members() { - underTest.searchMembers(new SearchMembersWsRequest() + underTest.searchMembers(new SearchMembersRequest() .setOrganization("orga") .setSelected("selected") .setQuery("john") @@ -99,7 +99,7 @@ public class OrganizationServiceTest { @Test public void update_project_visibility() { - underTest.updateProjectVisibility(UpdateProjectVisibilityWsRequest.builder() + underTest.updateProjectVisibility(UpdateProjectVisibilityRequest.builder() .setOrganization("O1") .setProjectVisibility("private") .build()); 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 0d51269ce80..9287748363f 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 @@ -83,7 +83,7 @@ public class PermissionsServiceTest { @Test public void groups_does_POST_on_WS_groups() { - GroupsWsRequest request = new GroupsWsRequest(); + GroupsRequest request = new GroupsRequest(); underTest.groups(request .setPermission(PERMISSION_VALUE) .setProjectId(PROJECT_ID_VALUE) @@ -107,7 +107,7 @@ public class PermissionsServiceTest { @Test public void addGroup_does_POST_on_Ws_add_group() { - underTest.addGroup(new AddGroupWsRequest() + underTest.addGroup(new AddGroupRequest() .setOrganization(ORGANIZATION_VALUE) .setPermission(PERMISSION_VALUE) .setProjectId(PROJECT_ID_VALUE) @@ -131,7 +131,7 @@ public class PermissionsServiceTest { @Test public void addGroupToTemplate_does_POST_on_Ws_add_group_to_template() { underTest.addGroupToTemplate( - new AddGroupToTemplateWsRequest() + new AddGroupToTemplateRequest() .setGroupId(GROUP_ID_VALUE) .setGroupName(GROUP_NAME_VALUE) .setPermission(PERMISSION_VALUE) @@ -153,7 +153,7 @@ public class PermissionsServiceTest { @Test public void addUser_does_POST_on_Ws_add_user() { - underTest.addUser(new AddUserWsRequest() + underTest.addUser(new AddUserRequest() .setLogin(LOGIN_VALUE) .setOrganization(ORGANIZATION_VALUE) .setPermission(PERMISSION_VALUE) @@ -175,7 +175,7 @@ public class PermissionsServiceTest { @Test public void addUserToTemplate_does_POST_on_Ws_add_user_to_template() { - underTest.addUserToTemplate(new AddUserToTemplateWsRequest() + underTest.addUserToTemplate(new AddUserToTemplateRequest() .setOrganization(ORGANIZATION_VALUE) .setPermission(PERMISSION_VALUE) .setLogin(LOGIN_VALUE) @@ -197,7 +197,7 @@ public class PermissionsServiceTest { @Test public void applyTemplate_does_POST_on_Ws_apply_template() { - underTest.applyTemplate(new ApplyTemplateWsRequest() + underTest.applyTemplate(new ApplyTemplateRequest() .setOrganization(ORGANIZATION_VALUE) .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE) @@ -219,7 +219,7 @@ public class PermissionsServiceTest { @Test public void bulk_apply_template() { - underTest.bulkApplyTemplate(new BulkApplyTemplateWsRequest() + underTest.bulkApplyTemplate(new BulkApplyTemplateRequest() .setOrganization(ORGANIZATION_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE) @@ -248,7 +248,7 @@ public class PermissionsServiceTest { @Test public void createTemplate_does_POST_on_Ws_create_template() { - underTest.createTemplate(new CreateTemplateWsRequest() + underTest.createTemplate(new CreateTemplateRequest() .setOrganization(ORGANIZATION_VALUE) .setName(NAME_VALUE) .setDescription(DESCRIPTION_VALUE) @@ -268,7 +268,7 @@ public class PermissionsServiceTest { @Test public void deleteTemplate_does_POST_on_Ws_delete_template() { - underTest.deleteTemplate(new DeleteTemplateWsRequest() + underTest.deleteTemplate(new DeleteTemplateRequest() .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE) .setOrganization(ORGANIZATION_VALUE) @@ -286,7 +286,7 @@ public class PermissionsServiceTest { @Test public void removeGroup_does_POST_on_Ws_remove_group() { - underTest.removeGroup(new RemoveGroupWsRequest() + underTest.removeGroup(new RemoveGroupRequest() .setPermission(PERMISSION_VALUE) .setGroupId(GROUP_ID_VALUE) .setGroupName(GROUP_NAME_VALUE) @@ -310,7 +310,7 @@ public class PermissionsServiceTest { @Test public void removeGroupFromTemplate_does_POST_on_Ws_remove_group_from_template() { - underTest.removeGroupFromTemplate(new RemoveGroupFromTemplateWsRequest() + underTest.removeGroupFromTemplate(new RemoveGroupFromTemplateRequest() .setPermission(PERMISSION_VALUE) .setGroupId(GROUP_ID_VALUE) .setGroupName(GROUP_NAME_VALUE) @@ -334,7 +334,7 @@ public class PermissionsServiceTest { @Test public void removeUser_does_POST_on_Ws_remove_user() { - underTest.removeUser(new RemoveUserWsRequest() + underTest.removeUser(new RemoveUserRequest() .setPermission(PERMISSION_VALUE) .setLogin(LOGIN_VALUE) .setProjectId(PROJECT_ID_VALUE) @@ -354,7 +354,7 @@ public class PermissionsServiceTest { @Test public void removeUserFromTemplate_does_POST_on_Ws_remove_user_from_template() { - underTest.removeUserFromTemplate(new RemoveUserFromTemplateWsRequest() + underTest.removeUserFromTemplate(new RemoveUserFromTemplateRequest() .setPermission(PERMISSION_VALUE) .setLogin(LOGIN_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) @@ -387,7 +387,7 @@ public class PermissionsServiceTest { @Test public void searchProjectPermissions_does_GET_on_Ws_search_project_permissions() { - underTest.searchProjectPermissions(new SearchProjectPermissionsWsRequest() + underTest.searchProjectPermissions(new SearchProjectPermissionsRequest() .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE) .setQualifier(QUALIFIER_VALUE) @@ -411,7 +411,7 @@ public class PermissionsServiceTest { @Test public void searchTemplates_does_GET_on_Ws_search_templates() { - underTest.searchTemplates(new SearchTemplatesWsRequest() + underTest.searchTemplates(new SearchTemplatesRequest() .setQuery(QUERY_VALUE) ); @@ -425,7 +425,7 @@ public class PermissionsServiceTest { @Test public void setDefaultTemplate_does_POST_on_Ws_set_default_template() { - underTest.setDefaultTemplate(new SetDefaultTemplateWsRequest() + underTest.setDefaultTemplate(new SetDefaultTemplateRequest() .setQualifier(QUALIFIER_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE) @@ -443,7 +443,7 @@ public class PermissionsServiceTest { @Test public void updateTemplate_does_POST_on_Ws_update_template() { - underTest.updateTemplate(new UpdateTemplateWsRequest() + underTest.updateTemplate(new UpdateTemplateRequest() .setDescription(DESCRIPTION_VALUE) .setId(TEMPLATE_ID_VALUE) .setName(TEMPLATE_NAME_VALUE) @@ -463,7 +463,7 @@ public class PermissionsServiceTest { @Test public void add_project_creator_to_template() { - underTest.addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder() + underTest.addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() .setPermission(PERMISSION_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE) @@ -483,7 +483,7 @@ public class PermissionsServiceTest { @Test public void remove_project_creator_from_template() { - underTest.removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest.builder() + underTest.removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() .setPermission(PERMISSION_VALUE) .setTemplateId(TEMPLATE_ID_VALUE) .setTemplateName(TEMPLATE_NAME_VALUE) @@ -503,7 +503,7 @@ public class PermissionsServiceTest { @Test public void users() { - underTest.users(new UsersWsRequest() + underTest.users(new UsersRequest() .setOrganization("org") .setProjectKey("project") .setProjectId("ABCD") 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 657b7f0e478..9b8fbb04478 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 @@ -125,7 +125,7 @@ public class ProjectsServiceTest { @Test public void bulk_delete() { - underTest.bulkDelete(SearchWsRequest.builder() + underTest.bulkDelete(SearchRequest.builder() .setOrganization("default") .setQuery("project") .setQualifiers(asList("TRK", "VW")) @@ -147,7 +147,7 @@ public class ProjectsServiceTest { @Test public void search() { - underTest.search(SearchWsRequest.builder() + underTest.search(SearchRequest.builder() .setOrganization("default") .setQuery("project") .setQualifiers(asList("TRK", "VW")) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.java new file mode 100644 index 00000000000..ee64ad762ca --- /dev/null +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.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.project; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; +import static org.assertj.core.api.Assertions.assertThat; + +public class SearchRequestTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void create_request() throws Exception { + SearchRequest underTest = SearchRequest.builder() + .setOrganization("orga") + .setQuery("project") + .setQualifiers(asList("TRK", "VW")) + .setPage(5) + .setPageSize(10) + .build(); + + assertThat(underTest.getOrganization()).isEqualTo("orga"); + assertThat(underTest.getQuery()).isEqualTo("project"); + assertThat(underTest.getQualifiers()).containsOnly("TRK", "VW"); + assertThat(underTest.getPage()).isEqualTo(5); + assertThat(underTest.getPageSize()).isEqualTo(10); + } + + @Test + public void fail_when_page_size_is_greater_then_500() throws Exception { + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage("Page size must not be greater than 500"); + + SearchRequest.builder() + .setPageSize(10000) + .build(); + } + + @Test + public void fail_if_project_key_list_is_empty() { + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage("Project key list must not be empty"); + + SearchRequest.builder() + .setProjects(emptyList()) + .build(); + } + + @Test + public void fail_if_project_id_list_is_empty() { + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage("Project id list must not be empty"); + + SearchRequest.builder() + .setProjectIds(emptyList()) + .build(); + } +} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchWsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchWsRequestTest.java deleted file mode 100644 index bf0f455215d..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchWsRequestTest.java +++ /dev/null @@ -1,81 +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.project; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; -import static org.assertj.core.api.Assertions.assertThat; - -public class SearchWsRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void create_request() throws Exception { - SearchWsRequest underTest = SearchWsRequest.builder() - .setOrganization("orga") - .setQuery("project") - .setQualifiers(asList("TRK", "VW")) - .setPage(5) - .setPageSize(10) - .build(); - - assertThat(underTest.getOrganization()).isEqualTo("orga"); - assertThat(underTest.getQuery()).isEqualTo("project"); - assertThat(underTest.getQualifiers()).containsOnly("TRK", "VW"); - assertThat(underTest.getPage()).isEqualTo(5); - assertThat(underTest.getPageSize()).isEqualTo(10); - } - - @Test - public void fail_when_page_size_is_greater_then_500() throws Exception { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Page size must not be greater than 500"); - - SearchWsRequest.builder() - .setPageSize(10000) - .build(); - } - - @Test - public void fail_if_project_key_list_is_empty() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Project key list must not be empty"); - - SearchWsRequest.builder() - .setProjects(emptyList()) - .build(); - } - - @Test - public void fail_if_project_id_list_is_empty() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Project id list must not be empty"); - - SearchWsRequest.builder() - .setProjectIds(emptyList()) - .build(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java new file mode 100644 index 00000000000..7b99e955c7b --- /dev/null +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java @@ -0,0 +1,49 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonarqube.ws.client.project; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +public class UpdateKeyRequestTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + UpdateKeyRequest.Builder underTest = UpdateKeyRequest.builder(); + + @Test + public void fail_if_new_key_is_null() { + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage("The new key must not be empty"); + + underTest.setNewKey(null).build(); + } + + @Test + public void fail_if_new_key_is_empty() { + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage("The new key must not be empty"); + + underTest.setNewKey("").build(); + } +} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java deleted file mode 100644 index 0eb51978769..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java +++ /dev/null @@ -1,49 +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.project; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class UpdateKeyWsRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - UpdateKeyWsRequest.Builder underTest = UpdateKeyWsRequest.builder(); - - @Test - public void fail_if_new_key_is_null() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("The new key must not be empty"); - - underTest.setNewKey(null).build(); - } - - @Test - public void fail_if_new_key_is_empty() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("The new key must not be empty"); - - underTest.setNewKey("").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 015186a588e..2718136410c 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 @@ -61,7 +61,7 @@ public class QualityProfilesServiceTest { @Test public void search() { - underTest.search(new SearchWsRequest() + underTest.search(new SearchRequest() .setDefaults(true) .setProjectKey("project") .setLanguage("language") @@ -184,7 +184,7 @@ public class QualityProfilesServiceTest { @Test public void activate_rule() { - underTest.activateRule(ActivateRuleWsRequest.builder() + underTest.activateRule(ActivateRuleRequest.builder() .setRuleKey("R1") .setKey("P1") .setOrganization("O1") 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 c0615144afd..a02bb02e8be 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java @@ -45,8 +45,8 @@ 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 org.sonarqube.ws.client.component.SuggestionsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -226,14 +226,14 @@ public class AnalysisEsResilienceTest { } private Issues.SearchWsResponse searchIssues(String projectKey) { - SearchWsRequest request = new SearchWsRequest() + SearchRequest request = new SearchRequest() .setProjectKeys(Collections.singletonList(projectKey)) .setFacets(Collections.singletonList("statuses")); return tester.wsClient().issues().search(request); } private List searchFile(String key, Organization organization) { - SuggestionsWsRequest query = SuggestionsWsRequest.builder() + SuggestionsRequest query = SuggestionsRequest.builder() .setS(key) .build(); Map response = ItUtils.jsonToMap( 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 14b60781d47..6d291bca43d 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java @@ -32,9 +32,9 @@ import org.sonarqube.ws.Favorites.Favorite; import org.sonarqube.ws.Permissions; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.favorites.SearchRequest; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; -import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateWsRequest; -import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; +import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateRequest; +import org.sonarqube.ws.client.permission.SearchTemplatesRequest; import static com.sonar.orchestrator.container.Server.ADMIN_LOGIN; import static com.sonar.orchestrator.container.Server.ADMIN_PASSWORD; @@ -105,18 +105,18 @@ public class FavoriteTest { } private void addProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder() + adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) .setPermission("admin") .build()); } private void removeProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissions().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest.builder() + adminWsClient.permissions().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) .setPermission("admin") .build()); 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 980cd9cafae..17c6a7357bb 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java @@ -28,7 +28,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.sonarqube.ws.Components.Component; -import org.sonarqube.ws.client.component.TreeWsRequest; +import org.sonarqube.ws.client.component.TreeRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -134,6 +134,6 @@ public class FileExclusionsTest { } public static List getComponents(String qualifier) { - return newWsClient(orchestrator).components().tree(new TreeWsRequest().setBaseComponentKey(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList(); + return newWsClient(orchestrator).components().tree(new TreeRequest().setBaseComponentKey(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList(); } } 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 b7d8921246d..d595e032cad 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java @@ -31,7 +31,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.ws.UserTokens; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.usertokens.GenerateRequest; import org.sonarqube.ws.client.usertokens.RevokeRequest; import org.sonarqube.ws.client.usertokens.UserTokensService; @@ -147,7 +147,7 @@ public class PermissionTest { } private void addUserPermission(String login, String permission, @Nullable String projectKey) { - adminWsClient.permissions().addUser(new AddUserWsRequest() + adminWsClient.permissions().addUser(new AddUserRequest() .setLogin(login) .setPermission(permission) .setProjectKey(projectKey)); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java index 53e0dc50abb..bdc330eec29 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java @@ -33,7 +33,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonarqube.qa.util.Tester; import org.sonarqube.tests.Category3Suite; -import org.sonarqube.ws.client.component.SearchWsRequest; +import org.sonarqube.ws.client.component.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -68,7 +68,7 @@ public class ScannerTest { scan("shared/xoo-multi-modules-sample"); scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x"); - assertThat(tester.wsClient().components().search(new SearchWsRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2); + assertThat(tester.wsClient().components().search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2); assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample").getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample"); assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample:branch/0.x").getName()) .isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x"); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java index 78f8cfc1e0a..3f3c0750f75 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.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.client.permission.AddGroupWsRequest; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; +import org.sonarqube.ws.client.permission.AddGroupRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; +import org.sonarqube.ws.client.permission.RemoveGroupRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -112,7 +112,7 @@ public class ExecuteAnalysisPermissionTest { @Test public void execute_analysis_with_scan_on_default_template() { removeGlobalPermission("anyone", "scan"); - tester.wsClient().permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder() + tester.wsClient().permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() .setPermission("scan") .setTemplateId("default_template") .build()); @@ -121,15 +121,15 @@ public class ExecuteAnalysisPermissionTest { } private void addProjectPermission(String groupName, String projectKey, String permission) { - tester.wsClient().permissions().addGroup(new AddGroupWsRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); } private void addGlobalPermission(String groupName, String permission) { - tester.wsClient().permissions().addGroup(new AddGroupWsRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setPermission(permission)); } private void removeGlobalPermission(String groupName, String permission) { - tester.wsClient().permissions().removeGroup(new RemoveGroupWsRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName(groupName).setPermission(permission)); } private static void executeLoggedAnalysis() { diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java index 910bb6124c2..d3734d24e05 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java @@ -33,7 +33,7 @@ import org.sonar.wsclient.user.UserParameters; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; import org.sonarqube.ws.client.issue.BulkChangeRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import util.ItUtils; @@ -265,7 +265,7 @@ public class IssuePermissionTest { private void addUserPermission(String login, String projectKey, String permission) { tester.wsClient().permissions().addUser( - new AddUserWsRequest() + new AddUserRequest() .setLogin(login) .setProjectKey(projectKey) .setPermission(permission)); 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 f14d2264b71..77a24d84976 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java @@ -30,18 +30,18 @@ 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; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; -import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; -import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; -import org.sonarqube.ws.client.permission.GroupsWsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupFromTemplateWsRequest; -import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateWsRequest; -import org.sonarqube.ws.client.permission.RemoveUserFromTemplateWsRequest; -import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; -import org.sonarqube.ws.client.permission.UsersWsRequest; +import org.sonarqube.ws.client.permission.AddGroupToTemplateRequest; +import org.sonarqube.ws.client.permission.AddGroupRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; +import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permission.CreateTemplateRequest; +import org.sonarqube.ws.client.permission.GroupsRequest; +import org.sonarqube.ws.client.permission.RemoveGroupFromTemplateRequest; +import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateRequest; +import org.sonarqube.ws.client.permission.RemoveUserFromTemplateRequest; +import org.sonarqube.ws.client.permission.SearchTemplatesRequest; +import org.sonarqube.ws.client.permission.UsersRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -79,11 +79,11 @@ public class PermissionSearchTest { @Test public void permission_web_services() { tester.wsClient().permissions().addUser( - new AddUserWsRequest() + new AddUserRequest() .setPermission("admin") .setLogin(LOGIN)); tester.wsClient().permissions().addGroup( - new AddGroupWsRequest() + new AddGroupRequest() .setPermission("admin") .setGroupName(GROUP_NAME)); @@ -94,11 +94,11 @@ public class PermissionSearchTest { assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2); Permissions.UsersWsResponse users = tester.wsClient().permissions() - .users(new UsersWsRequest().setPermission("admin")); + .users(new UsersRequest().setPermission("admin")); assertThat(users.getUsersList()).extracting("login").contains(LOGIN); Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions() - .groups(new GroupsWsRequest() + .groups(new GroupsRequest() .setPermission("admin")); assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME); } @@ -106,31 +106,31 @@ public class PermissionSearchTest { @Test public void template_permission_web_services() { Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate( - new CreateTemplateWsRequest() + new CreateTemplateRequest() .setName("my-new-template") .setDescription("template-used-in-tests")); assertThat(createTemplateWsResponse.getPermissionTemplate().getName()).isEqualTo("my-new-template"); tester.wsClient().permissions().addUserToTemplate( - new AddUserToTemplateWsRequest() + new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); tester.wsClient().permissions().addGroupToTemplate( - new AddGroupToTemplateWsRequest() + new AddGroupToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); tester.wsClient().permissions().addProjectCreatorToTemplate( - AddProjectCreatorToTemplateWsRequest.builder() + AddProjectCreatorToTemplateRequest.builder() .setPermission("admin") .setTemplateName("my-new-template") .build()); SearchTemplatesWsResponse searchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( - new SearchTemplatesWsRequest() + new SearchTemplatesRequest() .setQuery("my-new-template")); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getName()).isEqualTo("my-new-template"); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getKey()).isEqualTo("admin"); @@ -139,26 +139,26 @@ public class PermissionSearchTest { assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getWithProjectCreator()).isTrue(); tester.wsClient().permissions().removeGroupFromTemplate( - new RemoveGroupFromTemplateWsRequest() + new RemoveGroupFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); tester.wsClient().permissions().removeUserFromTemplate( - new RemoveUserFromTemplateWsRequest() + new RemoveUserFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); tester.wsClient().permissions().removeProjectCreatorFromTemplate( - RemoveProjectCreatorFromTemplateWsRequest.builder() + RemoveProjectCreatorFromTemplateRequest.builder() .setPermission("admin") .setTemplateName("my-new-template") .build() ); SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( - new SearchTemplatesWsRequest() + new SearchTemplatesRequest() .setQuery("my-new-template")); assertThat(clearedSearchTemplatesWsResponse.getPermissionTemplates(0).getPermissionsList()) .extracting(Permission::getUsersCount, Permission::getGroupsCount, Permission::getWithProjectCreator) diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java index 8ef4d43e9f9..f5149f8c631 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java @@ -26,9 +26,9 @@ 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 org.sonarqube.ws.client.permission.AddUserToTemplateRequest; +import org.sonarqube.ws.client.permission.CreateTemplateRequest; +import org.sonarqube.ws.client.permission.UsersRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -48,9 +48,9 @@ public class PermissionTemplatePageTest { String userLogin = tester.users().generateMemberOfDefaultOrganization().getLogin(); String adminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin(); - tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest().setName("foo-template")); + tester.wsClient().permissions().createTemplate(new CreateTemplateRequest().setName("foo-template")); tester.wsClient().permissions().addUserToTemplate( - new AddUserToTemplateWsRequest() + new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("foo-template") .setLogin(userLogin)); @@ -58,7 +58,7 @@ public class PermissionTemplatePageTest { ProjectsManagementPage page = tester.openBrowser().logIn().submitCredentials(adminLogin).openProjectsManagement(); page.shouldHaveProject(project); page.bulkApplyPermissionTemplate("foo-template"); - Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest() + Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersRequest() .setProjectKey(project) .setPermission("admin") ); 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 a0d4d4c7860..1f20a5b549a 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java @@ -38,12 +38,12 @@ 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; -import org.sonarqube.ws.client.permission.ApplyTemplateWsRequest; -import org.sonarqube.ws.client.permission.BulkApplyTemplateWsRequest; -import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; +import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; +import org.sonarqube.ws.client.permission.ApplyTemplateRequest; +import org.sonarqube.ws.client.permission.BulkApplyTemplateRequest; +import org.sonarqube.ws.client.permission.CreateTemplateRequest; import org.sonarqube.ws.client.permission.PermissionsService; -import org.sonarqube.ws.client.permission.UsersWsRequest; +import org.sonarqube.ws.client.permission.UsersRequest; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; @@ -90,7 +90,7 @@ public class PermissionTemplateTest { CreateWsResponse.User user = tester.users().generateMember(organization); CreateWsResponse.User anotherUser = tester.users().generateMember(organization); Permissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate(); - tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateWsRequest() + tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setLogin(user.getLogin()) @@ -99,7 +99,7 @@ public class PermissionTemplateTest { Project project2 = createPrivateProject(organization); Project untouchedProject = createPrivateProject(organization); - tester.wsClient().permissions().bulkApplyTemplate(new BulkApplyTemplateWsRequest() + tester.wsClient().permissions().bulkApplyTemplate(new BulkApplyTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setProjects(Arrays.asList(project1.getKey(), project2.getKey()))); @@ -157,23 +157,23 @@ public class PermissionTemplateTest { private void createAndApplyTemplate(Organization organization, Project project, CreateWsResponse.User user) { String templateName = "For user"; PermissionsService service = tester.wsClient().permissions(); - service.createTemplate(new CreateTemplateWsRequest() + service.createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(templateName) .setDescription("Give admin permissions to single user")); - service.addUserToTemplate(new AddUserToTemplateWsRequest() + service.addUserToTemplate(new AddUserToTemplateRequest() .setOrganization(organization.getKey()) .setLogin(user.getLogin()) .setPermission("user") .setTemplateName(templateName)); - service.applyTemplate(new ApplyTemplateWsRequest() + service.applyTemplate(new ApplyTemplateRequest() .setOrganization(organization.getKey()) .setProjectKey(project.getKey()) .setTemplateName(templateName)); } private CreateTemplateWsResponse createTemplate(Organization organization) { - return tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest() + return tester.wsClient().permissions().createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(randomAlphabetic(20))); } @@ -199,7 +199,7 @@ public class PermissionTemplateTest { } private boolean hasBrowsePermission(CreateWsResponse.User user, Organization organization, Project project) { - UsersWsRequest request = new UsersWsRequest() + UsersRequest request = new UsersRequest() .setOrganization(organization.getKey()) .setProjectKey(project.getKey()) .setPermission("user"); 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 3a9da8f55a0..f2dd1d9a704 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java @@ -27,10 +27,10 @@ import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; 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; -import org.sonarqube.ws.client.permission.RemoveUserWsRequest; +import org.sonarqube.ws.client.permission.AddGroupRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permission.RemoveGroupRequest; +import org.sonarqube.ws.client.permission.RemoveUserRequest; import org.sonarqube.ws.client.project.CreateRequest; import util.ItUtils; @@ -58,7 +58,7 @@ public class ProvisioningPermissionTest { @BeforeClass public static void init() { // remove default permission "provisioning" from anyone(); - tester.wsClient().permissions().removeGroup(new RemoveGroupWsRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("provisioning")); tester.users().generate(u -> u.setLogin(ADMIN_WITH_PROVISIONING).setPassword(PASSWORD)); addUserPermission(ADMIN_WITH_PROVISIONING, "admin"); @@ -77,7 +77,7 @@ public class ProvisioningPermissionTest { @AfterClass public static void restoreData() throws Exception { - tester.wsClient().permissions().addGroup(new AddGroupWsRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("provisioning")); } /** @@ -130,10 +130,10 @@ public class ProvisioningPermissionTest { } private static void addUserPermission(String login, String permission) { - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(login).setPermission(permission)); } private static void removeUserPermission(String login, String permission) { - tester.wsClient().permissions().removeUser(new RemoveUserWsRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissions().removeUser(new RemoveUserRequest().setLogin(login).setPermission(permission)); } } diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java index 97d784d596a..c06e735a031 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java @@ -24,7 +24,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import util.selenium.Selenese; @@ -49,7 +49,7 @@ public class QualityProfileAdminPermissionTest { tester.users().generate(u -> u.setLogin("not_profileadm").setPassword("userpwd")); tester.users().generate(u -> u.setLogin("profileadm").setPassword("papwd")); - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin("profileadm").setPermission("profileadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin("profileadm").setPermission("profileadmin")); createProfile("xoo", "foo"); Selenese.runSelenese(orchestrator, 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 ed6f9c9f82f..ccb74e981ec 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java @@ -48,7 +48,7 @@ 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; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; @@ -109,12 +109,12 @@ public class ReportFailureNotificationTest { 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() + tester.wsClient().permissions().addUser(new AddUserRequest() .setLogin(user1.getLogin()) .setPermission("admin") .setProjectKey(project1.getKey())); // user 2 is admin of project 2 but won't subscribe to global notifications - tester.wsClient().permissions().addUser(new AddUserWsRequest() + tester.wsClient().permissions().addUser(new AddUserRequest() .setLogin(user2.getLogin()) .setPermission("admin") .setProjectKey(project2.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 81a621d0e05..a14c73445df 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Components; -import org.sonarqube.ws.client.component.SearchWsRequest; -import org.sonarqube.ws.client.component.ShowWsRequest; +import org.sonarqube.ws.client.component.SearchRequest; +import org.sonarqube.ws.client.component.ShowRequest; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; @@ -53,7 +53,7 @@ public class ComponentsWsTest { @Test public void show() { - Components.ShowWsResponse response = tester.wsClient().components().show(new ShowWsRequest().setKey(FILE_KEY)); + Components.ShowWsResponse response = tester.wsClient().components().show(new ShowRequest().setKey(FILE_KEY)); assertThat(response).isNotNull(); assertThat(response.getComponent().getKey()).isEqualTo(FILE_KEY); @@ -62,7 +62,7 @@ public class ComponentsWsTest { @Test public void search() { - Components.SearchWsResponse response = tester.wsClient().components().search(new SearchWsRequest() + Components.SearchWsResponse response = tester.wsClient().components().search(new SearchRequest() .setQualifiers(singletonList("FIL"))); assertThat(response).isNotNull(); diff --git a/tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsTest.java b/tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsTest.java index 10d46f72611..934b045de47 100644 --- a/tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import util.issue.IssueRule; @@ -94,7 +94,7 @@ public class CrossProjectDuplicationsTest { @Test public void issue_on_duplicated_blocks_is_generated_on_file() throws Exception { - assertThat(issueRule.search(new SearchWsRequest().setComponentKeys(singletonList(DUPLICATE_FILE)).setRules(singletonList("common-xoo:DuplicatedBlocks"))).getIssuesList()) + assertThat(issueRule.search(new SearchRequest().setComponentKeys(singletonList(DUPLICATE_FILE)).setRules(singletonList("common-xoo:DuplicatedBlocks"))).getIssuesList()) .hasSize(1); } diff --git a/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationsTest.java b/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationsTest.java index 671513c579a..0efe0c0837b 100644 --- a/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationsTest.java @@ -30,7 +30,7 @@ import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import util.issue.IssueRule; @@ -153,7 +153,7 @@ public class DuplicationsTest { @Test public void issues_on_duplicated_blocks_are_generated_on_each_file() throws Exception { - assertThat(issueRule.search(new SearchWsRequest().setRules(singletonList("common-xoo:DuplicatedBlocks"))).getIssuesList()).hasSize(13); + assertThat(issueRule.search(new SearchRequest().setRules(singletonList("common-xoo:DuplicatedBlocks"))).getIssuesList()).hasSize(13); } @Test diff --git a/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java b/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java index 69cddb89b7a..e5a8aee0e5f 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java @@ -24,7 +24,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -87,7 +87,7 @@ public class CommonRulesTest extends AbstractIssueTest { private List findIssues(String componentKey, String ruleKey) { return adminWsClient.issues().search( - new SearchWsRequest() + new SearchRequest() .setComponents(singletonList(componentKey)) .setRules(singletonList(ruleKey))) .getIssuesList(); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java index 6ef4ae9573e..dbb4d6eef17 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java @@ -30,7 +30,7 @@ import org.sonarqube.ws.client.issue.AddCommentRequest; import org.sonarqube.ws.client.issue.AssignRequest; import org.sonarqube.ws.client.issue.EditCommentRequest; import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import org.sonarqube.ws.client.issue.SetSeverityRequest; import util.ProjectAnalysis; import util.ProjectAnalysisRule; @@ -157,18 +157,18 @@ public class IssueActionTest extends AbstractIssueTest { @Test public void assign() { assertThat(randomIssue.hasAssignee()).isFalse(); - Issues.SearchWsResponse response = issueRule.search(new SearchWsRequest().setIssues(singletonList(randomIssue.getKey()))); + Issues.SearchWsResponse response = issueRule.search(new SearchRequest().setIssues(singletonList(randomIssue.getKey()))); assertThat(response.getUsers().getUsersList()).isEmpty(); issuesService.assign(new AssignRequest(randomIssue.getKey(), "admin")); - assertThat(issueRule.search(new SearchWsRequest().setAssignees(singletonList("admin"))).getIssuesList()).hasSize(1); + assertThat(issueRule.search(new SearchRequest().setAssignees(singletonList("admin"))).getIssuesList()).hasSize(1); projectAnalysis.run(); Issue reloaded = issueRule.getByKey(randomIssue.getKey()); assertThat(reloaded.getAssignee()).isEqualTo("admin"); assertThat(reloaded.getCreationDate()).isEqualTo(randomIssue.getCreationDate()); - response = issueRule.search(new SearchWsRequest().setIssues(singletonList(randomIssue.getKey())).setAdditionalFields(singletonList("users"))); + response = issueRule.search(new SearchRequest().setIssues(singletonList(randomIssue.getKey())).setAdditionalFields(singletonList("users"))); assertThat(response.getUsers().getUsersList().stream().filter(user -> "admin".equals(user.getLogin())).findFirst()).isPresent(); assertThat(response.getUsers().getUsersList().stream().filter(user -> "Administrator".equals(user.getName())).findFirst()).isPresent(); @@ -176,7 +176,7 @@ public class IssueActionTest extends AbstractIssueTest { issuesService.assign(new AssignRequest(randomIssue.getKey(), null)); reloaded = issueRule.getByKey(randomIssue.getKey()); assertThat(reloaded.hasAssignee()).isFalse(); - assertThat(issueRule.search(new SearchWsRequest().setAssignees(singletonList("admin"))).getIssuesList()).isEmpty(); + assertThat(issueRule.search(new SearchRequest().setAssignees(singletonList("admin"))).getIssuesList()).isEmpty(); } /** @@ -194,7 +194,7 @@ public class IssueActionTest extends AbstractIssueTest { } private static List searchIssuesBySeverities(String projectKey, String severity) { - return issueRule.search(new SearchWsRequest().setProjectKeys(singletonList(projectKey)).setSeverities(singletonList(severity))).getIssuesList(); + return issueRule.search(new SearchRequest().setProjectKeys(singletonList(projectKey)).setSeverities(singletonList(severity))).getIssuesList(); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java index b62cf49a22c..4c4fd88cf2d 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java @@ -31,7 +31,7 @@ import org.sonarqube.ws.Issues; import org.sonarqube.ws.Issues.BulkChangeWsResponse; import org.sonarqube.ws.client.issue.BulkChangeRequest; import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ProjectAnalysis; import util.ProjectAnalysisRule; import util.issue.IssueRule; @@ -259,7 +259,7 @@ public class IssueBulkChangeTest extends AbstractIssueTest { } private static String[] searchIssueKeys(int limit) { - return getIssueKeys(issueRule.search(new SearchWsRequest()).getIssuesList(), limit); + return getIssueKeys(issueRule.search(new SearchRequest()).getIssuesList(), limit); } private static String[] getIssueKeys(List issues, int nbIssues) { diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java index 8012aec2ef7..a7a8708a382 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.sonarqube.ws.Issues; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -113,14 +113,14 @@ public class IssueFilterOnCommonRulesTest extends AbstractIssueTest { private List findIssuesByRuleKey(String ruleKey) { return adminWsClient.issues().search( - new SearchWsRequest() + new SearchRequest() .setComponents(singletonList(FILE_KEY)) .setRules(singletonList(ruleKey))) .getIssuesList(); } private List findAllIssues() { - return adminWsClient.issues().search(new SearchWsRequest()).getIssuesList(); + return adminWsClient.issues().search(new SearchRequest()).getIssuesList(); } } 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 b5bcef07954..529191d7145 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java @@ -52,8 +52,8 @@ import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.issue.AssignRequest; import org.sonarqube.ws.client.issue.BulkChangeRequest; -import org.sonarqube.ws.client.issue.SearchWsRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; @@ -174,7 +174,7 @@ public class IssueNotificationsTest { clearSmtpMessages(); // Change assignee - SearchWsResponse issues = tester.wsClient().issues().search(new SearchWsRequest().setProjectKeys(singletonList(PROJECT_KEY))); + SearchWsResponse issues = tester.wsClient().issues().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); Issue issue = issues.getIssuesList().get(0); tester.wsClient().issues().assign(new AssignRequest(issue.getKey(), userWithUserRole.getLogin())); @@ -245,7 +245,7 @@ public class IssueNotificationsTest { assertThat(smtpServer.getMessages()).hasSize(privateProject ? 2 : 3); clearSmtpMessages(); - SearchWsResponse issues = tester.wsClient().issues().search(new SearchWsRequest().setProjectKeys(singletonList(PROJECT_KEY))); + SearchWsResponse issues = tester.wsClient().issues().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); Issue issue = issues.getIssuesList().get(0); // bulk change without notification by default @@ -307,7 +307,7 @@ public class IssueNotificationsTest { .setEmail("userWithUserRole@nowhere.com")); tester.organizations().addMember(organization, userWithUserRole); tester.wsClient().permissions().addUser( - new AddUserWsRequest() + new AddUserRequest() .setLogin(userWithUserRole.getLogin()) .setProjectKey(PROJECT_KEY) .setPermission("user")); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java index 1ad0be32cd9..a6984ddb4eb 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java @@ -35,7 +35,7 @@ import org.sonar.wsclient.issue.Issue; import org.sonar.wsclient.issue.IssueQuery; import org.sonar.wsclient.issue.Issues; import org.sonarqube.ws.Common; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static java.util.Arrays.asList; @@ -261,16 +261,16 @@ public class IssueSearchTest extends AbstractIssueTest { @Test public void search_issues_by_types() throws IOException { - assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("CODE_SMELL"))).getPaging().getTotal()).isEqualTo(142); - assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("BUG"))).getPaging().getTotal()).isEqualTo(122); - assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("VULNERABILITY"))).getPaging().getTotal()).isEqualTo(8); + assertThat(searchIssues(new SearchRequest().setTypes(singletonList("CODE_SMELL"))).getPaging().getTotal()).isEqualTo(142); + assertThat(searchIssues(new SearchRequest().setTypes(singletonList("BUG"))).getPaging().getTotal()).isEqualTo(122); + assertThat(searchIssues(new SearchRequest().setTypes(singletonList("VULNERABILITY"))).getPaging().getTotal()).isEqualTo(8); } private List searchByRuleKey(String... ruleKey) throws IOException { - return searchIssues(new SearchWsRequest().setRules(asList(ruleKey))).getIssuesList(); + return searchIssues(new SearchRequest().setRules(asList(ruleKey))).getIssuesList(); } - private SearchWsResponse searchIssues(SearchWsRequest request) throws IOException { + private SearchWsResponse searchIssues(SearchRequest request) throws IOException { return newAdminWsClient(ORCHESTRATOR).issues().search(request); } 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 e802dc945ac..2e4f00e1885 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java @@ -32,8 +32,8 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; 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.issue.SearchRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.project.CreateRequest; import util.ItUtils; @@ -75,7 +75,7 @@ public class IssueTagsTest { .build()); analyzeProject(projectKey); - String issue = tester.wsClient().issues().search(new SearchWsRequest()).getIssues(0).getKey(); + String issue = tester.wsClient().issues().search(new SearchRequest()).getIssues(0).getKey(); tester.wsClient().issues().setTags(issue, "bla", "blubb"); String[] publicTags = {"bad-practice", "convention", "pitfall"}; @@ -112,7 +112,7 @@ public class IssueTagsTest { private void grantUserPermission(String projectKey, User member) { tester.wsClient().permissions().addUser( - new AddUserWsRequest() + new AddUserRequest() .setLogin(member.getLogin()) .setPermission("user") .setProjectKey(projectKey)); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java index 27a9ed0e80f..632cfa5d810 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.Issues.SearchWsResponse; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -71,7 +71,7 @@ public class IssueTrackingTest extends AbstractIssueTest { "sonar.projectDate", NEW_DATE_STR, "sonar.exclusions", "**/*.xoo"); - issues = searchIssues(new SearchWsRequest().setProjectKeys(singletonList("sample"))).getIssuesList(); + issues = searchIssues(new SearchRequest().setProjectKeys(singletonList("sample"))).getIssuesList(); assertThat(issues).hasSize(1); assertThat(issues.get(0).getStatus()).isEqualTo("CLOSED"); assertThat(issues.get(0).getResolution()).isEqualTo("FIXED"); @@ -119,14 +119,14 @@ public class IssueTrackingTest extends AbstractIssueTest { runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample"); // Only one issue is created - assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(1); + assertThat(searchIssues(new SearchRequest()).getIssuesList()).hasSize(1); Issue issue = getRandomIssue(); // Re analysis of the same project runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample"); // No new issue should be created - assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(1); + assertThat(searchIssues(new SearchRequest()).getIssuesList()).hasSize(1); // The issue on module should stay open and be the same from the first analysis Issue reloadIssue = getIssueByKey(issue.getKey()); @@ -146,14 +146,14 @@ public class IssueTrackingTest extends AbstractIssueTest { runProjectAnalysis(ORCHESTRATOR, "shared/xoo-multi-modules-sample"); // One issue by module are created - List issues = searchIssues(new SearchWsRequest()).getIssuesList(); + List issues = searchIssues(new SearchRequest()).getIssuesList(); assertThat(issues).hasSize(4); // Re analysis of the same project runProjectAnalysis(ORCHESTRATOR, "shared/xoo-multi-modules-sample"); // No new issue should be created - assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(issues.size()); + assertThat(searchIssues(new SearchRequest()).getIssuesList()).hasSize(issues.size()); // Issues on modules should stay open and be the same from the first analysis for (Issue issue : issues) { @@ -200,20 +200,20 @@ public class IssueTrackingTest extends AbstractIssueTest { } private List searchUnresolvedIssuesByComponent(String componentKey) { - return searchIssues(new SearchWsRequest().setComponentKeys(singletonList(componentKey)).setResolved(false)).getIssuesList(); + return searchIssues(new SearchRequest().setComponentKeys(singletonList(componentKey)).setResolved(false)).getIssuesList(); } private static Issue getRandomIssue() { - return searchIssues(new SearchWsRequest()).getIssues(0); + return searchIssues(new SearchRequest()).getIssues(0); } private static Issue getIssueByKey(String issueKey) { - SearchWsResponse search = searchIssues(new SearchWsRequest().setIssues(singletonList(issueKey))); + SearchWsResponse search = searchIssues(new SearchRequest().setIssues(singletonList(issueKey))); assertThat(search.getTotal()).isEqualTo(1); return search.getIssues(0); } - private static SearchWsResponse searchIssues(SearchWsRequest request) { + private static SearchWsResponse searchIssues(SearchRequest request) { return adminClient.issues().search(request); } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java index bfcd4afca84..47db3ad031c 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java @@ -28,7 +28,7 @@ import org.sonarqube.ws.Issues; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.client.issue.DoTransitionRequest; import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ProjectAnalysis; import util.ProjectAnalysisRule; import util.issue.IssueRule; @@ -70,7 +70,7 @@ public class IssueWorkflowTest extends AbstractIssueTest { */ @Test public void issue_is_closed_as_removed_when_rule_is_disabled() throws Exception { - SearchWsRequest ruleSearchRequest = new SearchWsRequest().setRules(singletonList("xoo:OneIssuePerLine")); + SearchRequest ruleSearchRequest = new SearchRequest().setRules(singletonList("xoo:OneIssuePerLine")); List issues = issueRule.search(ruleSearchRequest).getIssuesList(); assertThat(issues).isNotEmpty(); @@ -302,12 +302,12 @@ public class IssueWorkflowTest extends AbstractIssueTest { } private List transitions(String issueKey) { - Issues.SearchWsResponse response = searchIssues(new SearchWsRequest().setIssues(singletonList(issueKey)).setAdditionalFields(singletonList("transitions"))); + Issues.SearchWsResponse response = searchIssues(new SearchRequest().setIssues(singletonList(issueKey)).setAdditionalFields(singletonList("transitions"))); assertThat(response.getTotal()).isEqualTo(1); return response.getIssues(0).getTransitions().getTransitionsList(); } - private Issues.SearchWsResponse searchIssues(SearchWsRequest request) { + private Issues.SearchWsResponse searchIssues(SearchRequest request) { return newAdminWsClient(ORCHESTRATOR).issues().search(request); } 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 db359df1056..2f223fe66a1 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java @@ -35,7 +35,7 @@ import org.sonarqube.ws.Organizations; 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; +import org.sonarqube.ws.client.issue.SearchRequest; import org.sonarqube.ws.client.project.CreateRequest; import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; import org.sonarqube.qa.util.pageobjects.issues.IssuesPage; @@ -125,15 +125,15 @@ public class OrganizationIssueAssignTest { tester.organizations().addMember(org1, user); provisionAndAnalyseProject(SAMPLE_PROJECT_KEY, org1.getKey()); provisionAndAnalyseProject("sample2", org2.getKey()); - List issues = issueRule.search(new org.sonarqube.ws.client.issue.SearchWsRequest()).getIssuesList().stream().map(Issue::getKey).collect(Collectors.toList()); + List issues = issueRule.search(new SearchRequest()).getIssuesList().stream().map(Issue::getKey).collect(Collectors.toList()); Issues.BulkChangeWsResponse response = tester.wsClient().issues() .bulkChange(BulkChangeRequest.builder().setIssues(issues).setAssign(user.getLogin()).build()); assertThat(response.getIgnored()).isGreaterThan(0); - assertThat(issueRule.search(new SearchWsRequest().setProjectKeys(singletonList("sample"))).getIssuesList()).extracting(Issue::getAssignee) + assertThat(issueRule.search(new SearchRequest().setProjectKeys(singletonList("sample"))).getIssuesList()).extracting(Issue::getAssignee) .containsOnly(user.getLogin()); - assertThat(issueRule.search(new SearchWsRequest().setProjectKeys(singletonList("sample2"))).getIssuesList()).extracting(Issue::hasAssignee) + assertThat(issueRule.search(new SearchRequest().setProjectKeys(singletonList("sample2"))).getIssuesList()).extracting(Issue::hasAssignee) .containsOnly(false); } 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 66245b7259e..84c4c4c1bf3 100644 --- a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java @@ -28,11 +28,11 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; import org.sonarqube.ws.Components; import org.sonarqube.ws.Measures; -import org.sonarqube.ws.client.component.TreeWsRequest; +import org.sonarqube.ws.client.component.TreeRequest; import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.issue.SearchWsRequest; -import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; -import org.sonarqube.ws.client.measure.ComponentWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; import org.sonarqube.ws.client.measure.MeasuresService; import static java.util.Arrays.asList; @@ -64,18 +64,18 @@ public class LiteTest { public void call_issues_ws() { // all issues IssuesService issuesService = tester.wsClient().issues(); - Issues.SearchWsResponse response = issuesService.search(new SearchWsRequest()); + Issues.SearchWsResponse response = issuesService.search(new SearchRequest()); assertThat(response.getIssuesCount()).isGreaterThan(0); // project issues - response = issuesService.search(new SearchWsRequest().setProjectKeys(singletonList(PROJECT_KEY))); + response = issuesService.search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); assertThat(response.getIssuesCount()).isGreaterThan(0); } @Test public void call_components_ws() { // files in project - Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeWsRequest() + Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeRequest() .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(); - Measures.ComponentWsResponse component = measuresService.component(new ComponentWsRequest() + Measures.ComponentWsResponse component = measuresService.component(new ComponentRequest() .setComponentKey(PROJECT_KEY) .setMetricKeys(asList("lines", "ncloc", "files"))); assertThat(component.getComponent().getMeasuresCount()).isEqualTo(3); // file measures - Measures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeWsRequest() + Measures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeRequest() .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 e83ab8f5c8a..71f1460addf 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java @@ -30,8 +30,8 @@ import org.sonarqube.qa.util.Tester; 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; +import org.sonarqube.ws.client.measure.ComponentTreeRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; import static com.google.common.collect.Lists.newArrayList; import static java.util.Arrays.asList; @@ -59,7 +59,7 @@ public class MeasuresWsTest { public void component_tree() { scanXooSample(); - ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeWsRequest() + ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest() .setComponent("sample") .setMetricKeys(singletonList("ncloc")) .setAdditionalFields(asList("metrics", "periods"))); @@ -123,7 +123,7 @@ public class MeasuresWsTest { } private void verifyComponentTreeWithChildren(String baseComponentKey, String... childKeys) { - ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeWsRequest() + ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest() .setComponent(baseComponentKey) .setMetricKeys(singletonList("ncloc")) .setStrategy("children")); @@ -137,7 +137,7 @@ public class MeasuresWsTest { public void component() { scanXooSample(); - ComponentWsResponse response = tester.wsClient().measures().component(new ComponentWsRequest() + ComponentWsResponse response = tester.wsClient().measures().component(new ComponentRequest() .setComponent("sample") .setMetricKeys(singletonList("ncloc")) .setAdditionalFields(newArrayList("metrics", "periods"))); 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 33c6de854b8..3ee724c08a4 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java @@ -34,7 +34,7 @@ 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.organization.UpdateProjectVisibilityRequest; import org.sonarqube.ws.client.project.CreateRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import util.ItUtils; @@ -127,7 +127,7 @@ public class BillingTest { public void does_not_fail_to_update_default_projects_visibility_to_private() { tester.settings().setGlobalSettings("sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false"); - tester.wsClient().organizations().updateProjectVisibility(UpdateProjectVisibilityWsRequest.builder() + tester.wsClient().organizations().updateProjectVisibility(UpdateProjectVisibilityRequest.builder() .setOrganization(organization.getKey()) .setProjectVisibility("private") .build()); @@ -143,7 +143,7 @@ public class BillingTest { expectHttpError(400, format("Organization %s cannot use private project", organization.getKey()), () -> tester.wsClient().organizations() - .updateProjectVisibility(UpdateProjectVisibilityWsRequest.builder().setOrganization(organization.getKey()).setProjectVisibility("private").build())); + .updateProjectVisibility(UpdateProjectVisibilityRequest.builder().setOrganization(organization.getKey()).setProjectVisibility("private").build())); } @Test 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 2b738c24afd..27168955514 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java @@ -31,7 +31,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations.Organization; import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.HttpException; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; public class OrganizationMembershipTest { @@ -78,7 +78,7 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); tester.organizations().assertThatMemberOf(organization, user); removeMembership(organization, user); @@ -91,7 +91,7 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); tester.organizations().assertThatMemberOf(organization, user); // Admin is the creator of the organization so he was granted with admin permission tester.wsClient().organizations().removeMember(organization.getKey(), "admin"); 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 a0067d75aa1..8995f90a42d 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java @@ -37,11 +37,11 @@ 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.CreateRequest; import org.sonarqube.ws.client.organization.OrganizationService; -import org.sonarqube.ws.client.organization.SearchWsRequest; -import org.sonarqube.ws.client.organization.UpdateWsRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.organization.SearchRequest; +import org.sonarqube.ws.client.organization.UpdateRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.roots.SetRootRequest; import org.sonarqube.ws.client.roots.UnsetRootRequest; @@ -77,7 +77,7 @@ public class OrganizationTest { @Test public void default_organization_should_exist() { - Organization defaultOrg = tester.organizations().service().search(SearchWsRequest.builder().build()) + Organization defaultOrg = tester.organizations().service().search(SearchRequest.builder().build()) .getOrganizationsList() .stream() .filter(Organization::getGuarded) @@ -111,7 +111,7 @@ public class OrganizationTest { assertThatBuiltInQualityProfilesExist(org); // update by key - service.update(new UpdateWsRequest.Builder() + service.update(new UpdateRequest.Builder() .setKey(org.getKey()) .setName("new name") .setDescription("new description") @@ -121,7 +121,7 @@ public class OrganizationTest { verifyOrganization(org, "new name", "new description", "new url", "new avatar url"); // remove optional fields - service.update(new UpdateWsRequest.Builder() + service.update(new UpdateRequest.Builder() .setKey(org.getKey()) .setName("new name 2") .setDescription("") @@ -136,7 +136,7 @@ public class OrganizationTest { assertThatQualityProfilesDoNotExist(org); // create again - service.create(new CreateWsRequest.Builder() + service.create(new CreateRequest.Builder() .setName(NAME) .setKey(org.getKey()) .build()) @@ -149,7 +149,7 @@ public class OrganizationTest { // create organization without key String name = "Foo Company to keyize"; String expectedKey = "foo-company-to-keyize"; - Organization createdOrganization = tester.organizations().service().create(new CreateWsRequest.Builder() + Organization createdOrganization = tester.organizations().service().create(new CreateRequest.Builder() .setName(name) .build()) .getOrganization(); @@ -163,7 +163,7 @@ public class OrganizationTest { OrganizationTester anonymousTester = tester.asAnonymous().organizations(); expectForbiddenError(() -> anonymousTester.generate()); - expectUnauthorizedError(() -> anonymousTester.service().update(new UpdateWsRequest.Builder().setKey(org.getKey()).setName("new name").build())); + expectUnauthorizedError(() -> anonymousTester.service().update(new UpdateRequest.Builder().setKey(org.getKey()).setName("new name").build())); expectUnauthorizedError(() -> anonymousTester.service().delete(org.getKey())); } @@ -174,7 +174,7 @@ public class OrganizationTest { OrganizationTester userTester = tester.as(user.getLogin()).organizations(); expectForbiddenError(() -> userTester.generate()); - expectForbiddenError(() -> userTester.service().update(new UpdateWsRequest.Builder().setKey(org.getKey()).setName("new name").build())); + expectForbiddenError(() -> userTester.service().update(new UpdateRequest.Builder().setKey(org.getKey()).setName("new name").build())); expectForbiddenError(() -> userTester.service().delete(org.getKey())); } @@ -238,9 +238,9 @@ public class OrganizationTest { private void addPermissionsToUser(String orgKeyAndName, String login, String permission, String... otherPermissions) { PermissionsService permissionsService = tester.wsClient().permissions(); - permissionsService.addUser(new AddUserWsRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(permission)); + permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(permission)); for (String otherPermission : otherPermissions) { - permissionsService.addUser(new AddUserWsRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(otherPermission)); + permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(otherPermission)); } } @@ -294,7 +294,7 @@ public class OrganizationTest { assertThat(organization.getKey()).isNotEmpty(); assertThat(organization.getGuarded()).isFalse(); - List reloadedOrgs = tester.organizations().service().search(SearchWsRequest.builder().build()).getOrganizationsList(); + List reloadedOrgs = tester.organizations().service().search(SearchRequest.builder().build()).getOrganizationsList(); assertThat(reloadedOrgs) .filteredOn(o -> o.getKey().equals(organization.getKey())) .hasSize(1); @@ -302,20 +302,20 @@ public class OrganizationTest { private Components.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) { return componentsService - .search(new org.sonarqube.ws.client.component.SearchWsRequest() + .search(new org.sonarqube.ws.client.component.SearchRequest() .setOrganization(organizationKey) .setQualifiers(singletonList("TRK")) .setQuery("sample")); } private void assertThatOrganizationDoesNotExit(Organization org) { - SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(org.getKey()).build(); + SearchRequest request = new SearchRequest.Builder().setOrganizations(org.getKey()).build(); assertThat(tester.organizations().service().search(request).getOrganizationsList()).isEmpty(); } private void verifyOrganization(Organization createdOrganization, String name, String description, String url, String avatarUrl) { - SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(createdOrganization.getKey()).build(); + SearchRequest request = new SearchRequest.Builder().setOrganizations(createdOrganization.getKey()).build(); List result = tester.organizations().service().search(request).getOrganizationsList(); assertThat(result).hasSize(1); Organization searchedOrganization = result.get(0); @@ -339,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() + org.sonarqube.ws.client.qualityprofile.SearchRequest profilesRequest = new org.sonarqube.ws.client.qualityprofile.SearchRequest() .setOrganizationKey(org.getKey()); Qualityprofiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest); assertThat(response.getProfilesCount()).isGreaterThan(0); @@ -363,6 +363,6 @@ public class OrganizationTest { private void assertThatQualityProfilesDoNotExist(Organization org) { expectNotFoundError(() -> tester.wsClient().qualityProfiles().search( - new org.sonarqube.ws.client.qualityprofile.SearchWsRequest().setOrganizationKey(org.getKey()))); + new org.sonarqube.ws.client.qualityprofile.SearchRequest().setOrganizationKey(org.getKey()))); } } 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 a31f889a890..ac98f4e7d42 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; import org.sonarqube.ws.Users; -import org.sonarqube.ws.client.organization.SearchWsRequest; +import org.sonarqube.ws.client.organization.SearchRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -52,7 +52,7 @@ public class PersonalOrganizationTest { public void personal_organizations_are_created_for_new_users() { Users.CreateWsResponse.User user = tester.users().generate(); - List existing = tester.wsClient().organizations().search(SearchWsRequest.builder().build()).getOrganizationsList(); + List existing = tester.wsClient().organizations().search(SearchRequest.builder().build()).getOrganizationsList(); assertThat(existing) .filteredOn(Organizations.Organization::getGuarded) .filteredOn(o -> o.getKey().equals(user.getLogin())) 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 6d18fec7152..0ded98c31a3 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 @@ -37,7 +37,7 @@ import org.sonarqube.ws.Measures; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsClientFactories; -import org.sonarqube.ws.client.measure.ComponentWsRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; import static java.lang.Double.parseDouble; import static java.util.Arrays.asList; @@ -80,7 +80,7 @@ public class DuplicationTest extends AbstractPerfTest { } private Map getMeasures(String key) { - return newWsClient().measures().component(new ComponentWsRequest() + return newWsClient().measures().component(new ComponentRequest() .setComponentKey(key) .setMetricKeys(asList("duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density"))) .getComponent().getMeasuresList() 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 7036f46a69d..ce7fdb4bc33 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.java @@ -30,7 +30,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Organizations; import org.sonarqube.ws.Projects.CreateWsResponse; import org.sonarqube.ws.Projects.SearchWsResponse.Component; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.runProjectAnalysis; @@ -52,12 +52,12 @@ public class ProjectBulkDeletionTest { analyzeProject(analyzedProject.getKey(), organization.getKey()); - tester.wsClient().projects().bulkDelete(SearchWsRequest.builder() + tester.wsClient().projects().bulkDelete(SearchRequest.builder() .setOrganization(organization.getKey()) .setQuery("FIRST-PROVISIONED") .setOnProvisionedOnly(true).build()); - List projects = tester.wsClient().projects().search(SearchWsRequest.builder().setOrganization(organization.getKey()).build()).getComponentsList(); + List projects = tester.wsClient().projects().search(SearchRequest.builder().setOrganization(organization.getKey()).build()).getComponentsList(); assertThat(projects).extracting(Component::getKey) .containsExactlyInAnyOrder(analyzedProject.getKey(), secondProvisionedProject.getKey()) .doesNotContain(firstProvisionedProject.getKey()); @@ -67,7 +67,7 @@ public class ProjectBulkDeletionTest { 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().provision(organization)); - SearchWsRequest request = SearchWsRequest.builder().setOrganization(organization.getKey()).build(); + SearchRequest request = SearchRequest.builder().setOrganization(organization.getKey()).build(); assertThat(tester.wsClient().projects().search(request).getPaging().getTotal()).isEqualTo(60); tester.wsClient().projects().bulkDelete(request); 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 6495e142727..be1b0b441e6 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java @@ -43,7 +43,7 @@ import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; import org.sonarqube.ws.client.project.CreateRequest; import org.sonarqube.ws.client.project.DeleteRequest; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -165,7 +165,7 @@ public class ProjectDeletionTest { } private void bulkDeleteProjects(Organizations.Organization organization, Project... projects) { - SearchWsRequest request = SearchWsRequest.builder() + SearchRequest request = SearchRequest.builder() .setOrganization(organization.getKey()) .setProjects(Arrays.stream(projects).map(Project::getKey).collect(Collectors.toList())) .build(); @@ -194,7 +194,7 @@ public class ProjectDeletionTest { */ private boolean isInProjectsSearch(Organizations.Organization organization, String name) { Projects.SearchWsResponse response = tester.wsClient().projects().search( - SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build()); + SearchRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build()); return response.getComponentsCount() > 0; } 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 b560d54c68f..d209d9154f5 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java @@ -40,10 +40,10 @@ import org.sonarqube.ws.Projects; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; -import org.sonarqube.ws.client.component.ShowWsRequest; -import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest; +import org.sonarqube.ws.client.component.ShowRequest; +import org.sonarqube.ws.client.project.BulkUpdateKeyRequest; import org.sonarqube.ws.client.project.CreateRequest; -import org.sonarqube.ws.client.project.UpdateKeyWsRequest; +import org.sonarqube.ws.client.project.UpdateKeyRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -71,31 +71,31 @@ public class ProjectKeyUpdateTest { public void update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().components().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); - tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder() + tester.wsClient().projects().updateKey(UpdateKeyRequest.builder() .setKey(PROJECT_KEY) .setNewKey(newProjectKey) .build()); - assertThat(tester.wsClient().components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + assertThat(tester.wsClient().components().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); } @Test public void bulk_update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().components().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); - Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder() + Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyRequest.builder() .setKey(PROJECT_KEY) .setFrom(PROJECT_KEY) .setTo(newProjectKey) .build()); - assertThat(tester.wsClient().components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + assertThat(tester.wsClient().components().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); assertThat(result.getKeysCount()).isEqualTo(1); assertThat(result.getKeys(0)) .extracting(Projects.BulkUpdateKeyWsResponse.Key::getKey, Projects.BulkUpdateKeyWsResponse.Key::getNewKey, Projects.BulkUpdateKeyWsResponse.Key::getDuplicate) @@ -229,11 +229,11 @@ public class ProjectKeyUpdateTest { } private void updateKey(Projects.CreateWsResponse.Project project, String newKey) { - tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(project.getKey()).setNewKey(newKey).build()); + tester.wsClient().projects().updateKey(UpdateKeyRequest.builder().setKey(project.getKey()).setNewKey(newKey).build()); } private void updateKey(String initialKey, String newKey) { - tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(initialKey).setNewKey(newKey).build()); + tester.wsClient().projects().updateKey(UpdateKeyRequest.builder().setKey(initialKey).setNewKey(newKey).build()); } private Projects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) { 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 de8a6b65abc..4eb51516718 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java @@ -37,7 +37,7 @@ import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.component.SearchProjectsRequest; import org.sonarqube.ws.client.project.CreateRequest; -import org.sonarqube.ws.client.project.SearchWsRequest; +import org.sonarqube.ws.client.project.SearchRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -101,7 +101,7 @@ public class ProjectProvisioningTest { */ private boolean isInProjectsSearch(Organizations.Organization organization, String name) { Projects.SearchWsResponse response = tester.wsClient().projects().search( - SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build()); + SearchRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).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 65da3c02981..12508573f70 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectSearchTest.java @@ -32,7 +32,7 @@ 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; +import org.sonarqube.ws.client.project.SearchRequest; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; @@ -59,7 +59,7 @@ public class ProjectSearchTest { analyzeProject(oldProject.getKey(), moreThanOneYearAgo, organization.getKey()); analyzeProject(recentProject.getKey(), now, organization.getKey()); - SearchWsResponse result = tester.wsClient().projects().search(SearchWsRequest.builder() + SearchWsResponse result = tester.wsClient().projects().search(SearchRequest.builder() .setOrganization(organization.getKey()) .setQualifiers(singletonList("TRK")) .setAnalyzedBefore(formatDate(oneYearAgo)).build()); @@ -78,7 +78,7 @@ public class ProjectSearchTest { analyzeProject(upperCaseProject.getKey(), organization.getKey()); analyzeProject(anotherProject.getKey(), organization.getKey()); - SearchWsResponse result = tester.wsClient().projects().search(SearchWsRequest.builder() + SearchWsResponse result = tester.wsClient().projects().search(SearchRequest.builder() .setOrganization(organization.getKey()) .setQualifiers(singletonList("TRK")) .setQuery("JeCt-K") @@ -101,7 +101,7 @@ public class ProjectSearchTest { String result = tester.wsClient().wsConnector().call(new GetRequest("api/projects/provisioned") .setParam("organization", organization.getKey())) .failIfNotSuccessful().content(); - SearchWsResponse searchResult = tester.wsClient().projects().search(SearchWsRequest.builder() + SearchWsResponse searchResult = tester.wsClient().projects().search(SearchRequest.builder() .setQualifiers(singletonList("TRK")) .setOrganization(organization.getKey()) .setOnProvisionedOnly(true).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 92699c3332c..cc7546065c2 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java @@ -29,7 +29,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; import org.sonarqube.ws.Components; import org.sonarqube.ws.client.component.SearchProjectsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; +import org.sonarqube.ws.client.permission.RemoveGroupRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -57,7 +57,7 @@ public class ProjectVisibilityPageTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample2")); tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("sample2").setVisibility("private").build()); // Remove 'Admin' permission for admin group on project 2 -> No one can access or admin this project, expect System Admin - tester.wsClient().permissions().removeGroup(new RemoveGroupWsRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); tester.openBrowser().logIn().submitCredentials(adminUser) .openProjectsManagement("default-organization") 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 507410d6b6b..d311e4aab1b 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java @@ -32,6 +32,7 @@ import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage; import org.sonarqube.qa.util.pageobjects.QualityGatePage; import org.sonarqube.ws.Organizations; import org.sonarqube.ws.Users; +import org.sonarqube.ws.client.permission.AddUserRequest; import util.issue.IssueRule; import static com.codeborne.selenide.Selenide.$; @@ -58,7 +59,7 @@ public class OrganizationQualityGateUiTest { organization = tester.organizations().generate(); gateAdmin = tester.users().generate(); tester.organizations().addMember(tester.organizations().getDefaultOrganization(), gateAdmin); - tester.wsClient().permissions().addUser(new org.sonarqube.ws.client.permission.AddUserWsRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); user = tester.users().generate(); tester.organizations().addMember(organization, user); restoreProfile(orchestrator, getClass().getResource("/issue/with-many-rules.xml"), organization.getKey()); 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 12be1f95854..51439df8ea9 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java @@ -54,7 +54,7 @@ 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.permission.AddUserRequest; import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; import org.sonarqube.ws.client.qualitygates.CreateRequest; import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest; @@ -293,7 +293,7 @@ public class QualityGateTest { // user is quality gate admin of default organization Organization organization = tester.organizations().getDefaultOrganization(); Users.CreateWsResponse.User user = tester.users().generateMember(organization); - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); TesterSession qGateAdminTester = tester.as(user.getLogin()); QualitygatesService qGateService = qGateAdminTester.qGates().service(); // perform administration operations diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java index 0bf2f9db32b..6e2ef0c0674 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -58,7 +58,7 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.oneIssuePerFile.effortToFix", "10")); - Issues.Issue firstIssue = tester.wsClient().issues().search(new SearchWsRequest()).getIssues(0); + Issues.Issue firstIssue = tester.wsClient().issues().search(new SearchRequest()).getIssues(0); List changes = changelog(firstIssue.getKey()).getChangelogList(); assertThat(changes).hasSize(1); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java index 5ce1e174a44..24d60d3b88a 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -54,7 +54,7 @@ public class TechnicalDebtTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // All the issues should have a technical debt - List issues = tester.wsClient().issues().search(new SearchWsRequest()).getIssuesList(); + List issues = tester.wsClient().issues().search(new SearchRequest()).getIssuesList(); assertThat(issues).isNotEmpty(); for (Issues.Issue issue : issues) { assertThat(issue.getDebt()).isEqualTo("1min"); 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 3922d96b29c..ef08e8e8317 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -31,8 +31,8 @@ import org.junit.Test; import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddGroupWsRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddGroupRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import org.subethamail.wiser.Wiser; @@ -77,7 +77,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); orchestrator.restartServer(); @@ -100,12 +100,12 @@ public class BuiltInQualityProfilesNotificationTest { // Create a quality profile administrator (user having direct permission) Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // Create a quality profile administrator (user having permission from a group) 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.permissions().addGroup(new AddGroupRequest().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 Users.CreateWsResponse.User noProfileAdmin = userRule.generate(); @@ -156,7 +156,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // uninstall plugin V1 wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful(); 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 2ace14e222a..be5eb2a3ee9 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesTest.java @@ -36,7 +36,7 @@ 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; -import org.sonarqube.ws.client.qualityprofile.SearchWsRequest; +import org.sonarqube.ws.client.qualityprofile.SearchRequest; import org.sonarqube.ws.client.qualityprofile.SetDefaultRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -55,7 +55,7 @@ public class BuiltInQualityProfilesTest { @Test public void built_in_profiles_are_available_in_new_organization() { Organization org = tester.organizations().generate(); - SearchWsResponse result = tester.qProfiles().service().search(new SearchWsRequest().setOrganizationKey(org.getKey())); + SearchWsResponse result = tester.qProfiles().service().search(new SearchRequest().setOrganizationKey(org.getKey())); assertThat(result.getProfilesList()) .extracting(QualityProfile::getName, QualityProfile::getLanguage, QualityProfile::getIsBuiltIn, QualityProfile::getIsDefault) @@ -70,7 +70,7 @@ public class BuiltInQualityProfilesTest { @Test public void built_in_profiles_are_available_in_default_organization() { - SearchWsResponse result = tester.qProfiles().service().search(new SearchWsRequest().setOrganizationKey("default-organization")); + SearchWsResponse result = tester.qProfiles().service().search(new SearchRequest().setOrganizationKey("default-organization")); assertThat(result.getProfilesList()) .extracting(QualityProfile::getOrganization, QualityProfile::getName, QualityProfile::getLanguage, QualityProfile::getIsBuiltIn, QualityProfile::getIsDefault) @@ -154,7 +154,7 @@ public class BuiltInQualityProfilesTest { } private QualityProfile getProfile(Organization organization, Predicate filter) { - return tester.qProfiles().service().search(new SearchWsRequest() + return tester.qProfiles().service().search(new SearchRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() .filter(filter) 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 fe00a8d4472..ef5199d1b64 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java @@ -41,7 +41,7 @@ import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; import org.sonarqube.ws.client.qualityprofile.CopyRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; -import org.sonarqube.ws.client.qualityprofile.SearchWsRequest; +import org.sonarqube.ws.client.qualityprofile.SearchRequest; import org.sonarqube.ws.client.qualityprofile.SetDefaultRequest; import util.ItUtils; @@ -154,10 +154,10 @@ public class CustomQualityProfilesTest { tester.organizations().service().delete(org.getKey()); - expectMissingError(() -> tester.qProfiles().service().search(new SearchWsRequest() + expectMissingError(() -> tester.qProfiles().service().search(new SearchRequest() .setOrganizationKey(org.getKey()))); - tester.qProfiles().service().search(new SearchWsRequest()).getProfilesList() + tester.qProfiles().service().search(new SearchRequest()).getProfilesList() .forEach(p -> { assertThat(p.getOrganization()).isNotEqualTo(org.getKey()); assertThat(p.getKey()).isNotIn(parentProfile.getKey(), copyResponse.getKey(), inheritedProfile1.getKey(), inheritedProfile2.getKey()); @@ -319,7 +319,7 @@ public class CustomQualityProfilesTest { } private Qualityprofiles.SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { - return tester.qProfiles().service().search(new SearchWsRequest() + return tester.qProfiles().service().search(new SearchRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() .filter(filter) 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 b6e884eaa77..6b6ed149993 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java @@ -35,14 +35,13 @@ 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.permission.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.AddGroupRequest; -import org.sonarqube.ws.client.qualityprofile.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.RemoveGroupRequest; import org.sonarqube.ws.client.qualityprofile.RemoveUserRequest; import org.sonarqube.ws.client.qualityprofile.SearchGroupsRequest; import org.sonarqube.ws.client.qualityprofile.SearchUsersRequest; -import org.sonarqube.ws.client.qualityprofile.SearchWsRequest; +import org.sonarqube.ws.client.qualityprofile.SearchRequest; import org.sonarqube.ws.client.qualityprofile.ShowRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -211,7 +210,7 @@ public class QualityProfilesEditTest { CreateWsResponse.QualityProfile xooProfile3 = tester.qProfiles().createXooProfile(organization); SearchWsResponse result = tester.as(user.getLogin()) - .qProfiles().service().search(new SearchWsRequest().setOrganizationKey(organization.getKey())); + .qProfiles().service().search(new SearchRequest().setOrganizationKey(organization.getKey())); assertThat(result.getActions().getCreate()).isFalse(); assertThat(result.getProfilesList()) .extracting(SearchWsResponse.QualityProfile::getKey, qp -> qp.getActions().getEdit(), qp -> qp.getActions().getCopy(), qp -> qp.getActions().getSetAsDefault()) @@ -226,10 +225,10 @@ public class QualityProfilesEditTest { Organization organization = tester.organizations().generate(); User user = tester.users().generateMember(organization); CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); - tester.wsClient().permissions().addUser(new AddUserWsRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); SearchWsResponse result = tester.as(user.getLogin()) - .qProfiles().service().search(new SearchWsRequest().setOrganizationKey(organization.getKey())); + .qProfiles().service().search(new SearchRequest().setOrganizationKey(organization.getKey())); assertThat(result.getActions().getCreate()).isTrue(); assertThat(result.getProfilesList()) .extracting(SearchWsResponse.QualityProfile::getKey, qp -> qp.getActions().getEdit(), qp -> qp.getActions().getCopy(), qp -> qp.getActions().getSetAsDefault()) @@ -267,7 +266,7 @@ public class QualityProfilesEditTest { } private void addUserPermission(Organization organization, User user, CreateWsResponse.QualityProfile qProfile) { - tester.qProfiles().service().addUser(AddUserRequest.builder() + tester.qProfiles().service().addUser(org.sonarqube.ws.client.qualityprofile.AddUserRequest.builder() .setOrganization(organization.getKey()) .setQualityProfile(qProfile.getName()) .setLanguage(qProfile.getLanguage()) @@ -285,7 +284,7 @@ public class QualityProfilesEditTest { } private SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { - return tester.qProfiles().service().search(new SearchWsRequest() + return tester.qProfiles().service().search(new SearchRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() .filter(filter) 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 21b319f6f78..f7837897556 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java @@ -38,8 +38,8 @@ 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; -import org.sonarqube.ws.client.qualityprofile.ChangelogWsRequest; -import org.sonarqube.ws.client.qualityprofile.SearchWsRequest; +import org.sonarqube.ws.client.qualityprofile.ChangelogRequest; +import org.sonarqube.ws.client.qualityprofile.SearchRequest; import org.sonarqube.ws.client.qualityprofile.ShowRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -133,7 +133,7 @@ public class QualityProfilesWsTest { Organization org = tester.organizations().generate(); CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(org); - String changelog = tester.wsClient().qualityProfiles().changelog(ChangelogWsRequest.builder() + String changelog = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) @@ -143,14 +143,14 @@ public class QualityProfilesWsTest { tester.qProfiles().activateRule(profile, RULE_ONE_BUG_PER_LINE); tester.qProfiles().activateRule(profile, RULE_ONE_ISSUE_PER_LINE); - String changelog2 = tester.wsClient().qualityProfiles().changelog(ChangelogWsRequest.builder() + String changelog2 = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) .build()); JSONAssert.assertEquals(EXPECTED_CHANGELOG, changelog2, JSONCompareMode.LENIENT); - String changelog3 = tester.wsClient().qualityProfiles().changelog(ChangelogWsRequest.builder() + String changelog3 = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) @@ -160,7 +160,7 @@ public class QualityProfilesWsTest { } private SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { - return tester.qProfiles().service().search(new SearchWsRequest() + return tester.qProfiles().service().search(new SearchRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() .filter(filter) 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 f2249a9b6a8..31cef84c190 100644 --- a/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/rule/RulesWsTest.java @@ -83,7 +83,7 @@ public class RulesWsTest { } private SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate filter) { - return tester.qProfiles().service().search(new org.sonarqube.ws.client.qualityprofile.SearchWsRequest() + return tester.qProfiles().service().search(new org.sonarqube.ws.client.qualityprofile.SearchRequest() .setOrganizationKey(organization.getKey())).getProfilesList() .stream() .filter(filter) diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java index e9eb13360e9..d312aa09a3c 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java @@ -36,7 +36,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import util.ItUtils; import static java.lang.String.format; @@ -116,7 +116,7 @@ public class LogsTest { private void generateSqlAndEsLogsInWebAndCe() { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); - ItUtils.newAdminWsClient(orchestrator).issues().search(new SearchWsRequest() + ItUtils.newAdminWsClient(orchestrator).issues().search(new SearchRequest() .setProjectKeys(Collections.singletonList("sample"))); } 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 e1219ae9ee6..17bf6776746 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java @@ -32,7 +32,7 @@ import org.junit.rules.Timeout; import org.sonarqube.ws.System; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -97,7 +97,7 @@ public class RestartTest { private void createSystemAdministrator(String login, String password) { WsClient wsClient = newAdminWsClient(orchestrator); createNonSystemAdministrator(wsClient, login, password); - wsClient.permissions().addUser(new AddUserWsRequest().setLogin(login).setPermission("admin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); } private void createNonSystemAdministrator(String login, String password) { 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 9733ff6bb47..35741444b28 100644 --- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java @@ -35,9 +35,9 @@ import org.junit.rules.RuleChain; import org.sonarqube.tests.Category1Suite; import org.sonarqube.ws.Settings; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddGroupWsRequest; -import org.sonarqube.ws.client.permission.AddUserWsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; +import org.sonarqube.ws.client.permission.AddGroupRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permission.RemoveGroupRequest; import org.sonarqube.ws.client.settings.ResetRequest; import org.sonarqube.ws.client.settings.SetRequest; import org.sonarqube.ws.client.settings.SettingsService; @@ -81,7 +81,7 @@ public class SettingsTest { userRule.createUser("scanner-user", "scanner-user"); adminWsClient = newAdminWsClient(orchestrator); // Remove 'Execute Analysis' permission from anyone - adminWsClient.permissions().removeGroup(new RemoveGroupWsRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("scan")); // Anonymous user, without 'Execute Analysis' permission anonymousSettingsService = newWsClient(orchestrator).settings(); @@ -90,7 +90,7 @@ public class SettingsTest { userSettingsService = newUserWsClient(orchestrator, "setting-user", "setting-user").settings(); // User with 'Execute Analysis' permission - adminWsClient.permissions().addUser(new AddUserWsRequest().setLogin("scanner-user").setPermission("scan")); + adminWsClient.permissions().addUser(new AddUserRequest().setLogin("scanner-user").setPermission("scan")); scanSettingsService = newUserWsClient(orchestrator, "scanner-user", "scanner-user").settings(); // User with 'Administer System' permission but without 'Execute Analysis' permission @@ -101,7 +101,7 @@ public class SettingsTest { public static void tearDown() throws Exception { userRule.deactivateUsers("setting-user", "scanner-user"); // Restore 'Execute Analysis' permission to anyone - adminWsClient.permissions().addGroup(new AddGroupWsRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("scan")); } @After 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 607ef2d4615..9f5f1a87b9f 100644 --- a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java +++ b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java @@ -42,7 +42,7 @@ import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsClientFactories; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.measure.ComponentWsRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; import static com.codeborne.selenide.Condition.hasText; import static com.codeborne.selenide.Selenide.$; @@ -198,7 +198,7 @@ public class UpgradeTest { } private int countFiles(String key) { - Measure measure = newWsClient(orchestrator).measures().component(new ComponentWsRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files"))) + Measure measure = newWsClient(orchestrator).measures().component(new ComponentRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files"))) .getComponent().getMeasures(0); return parseInt(measure.getValue()); } 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 2f6e7f36f1b..7e9a294fc49 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java @@ -38,7 +38,7 @@ import org.sonarqube.tests.Category4Suite; 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; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.user.CreateRequest; import util.selenium.Selenese; @@ -125,7 +125,7 @@ public class OAuth2IdentityProviderTest { enablePlugin(); tester.users().generate(u -> u.setLogin(USER_LOGIN)); // Give user global admin permission as we want to go to a page where authentication is required - tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(USER_LOGIN).setPermission("admin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(USER_LOGIN).setPermission("admin")); Navigation nav = tester.openBrowser(); // Try to go to the settings page diff --git a/tests/src/test/java/util/ItUtils.java b/tests/src/test/java/util/ItUtils.java index 5f8a5a4b76b..7a9fbafcd54 100644 --- a/tests/src/test/java/util/ItUtils.java +++ b/tests/src/test/java/util/ItUtils.java @@ -70,9 +70,9 @@ import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpConnector; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsClientFactories; -import org.sonarqube.ws.client.component.ShowWsRequest; -import org.sonarqube.ws.client.measure.ComponentWsRequest; -import org.sonarqube.ws.client.qualityprofile.RestoreWsRequest; +import org.sonarqube.ws.client.component.ShowRequest; +import org.sonarqube.ws.client.measure.ComponentRequest; +import org.sonarqube.ws.client.qualityprofile.RestoreRequest; import org.sonarqube.ws.client.settings.ResetRequest; import org.sonarqube.ws.client.settings.SetRequest; @@ -334,7 +334,7 @@ public class ItUtils { } private static Stream getStreamMeasures(Orchestrator orchestrator, String componentKey, String... metricKeys) { - return newWsClient(orchestrator).measures().component(new ComponentWsRequest() + return newWsClient(orchestrator).measures().component(new ComponentRequest() .setComponent(componentKey) .setMetricKeys(asList(metricKeys))) .getComponent().getMeasuresList() @@ -343,7 +343,7 @@ public class ItUtils { @CheckForNull public static Measure getMeasureWithVariation(Orchestrator orchestrator, String componentKey, String metricKey) { - Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentWsRequest() + Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentRequest() .setComponentKey(componentKey) .setMetricKeys(singletonList(metricKey)) .setAdditionalFields(singletonList("periods"))); @@ -353,7 +353,7 @@ public class ItUtils { @CheckForNull public static Map getMeasuresWithVariationsByMetricKey(Orchestrator orchestrator, String componentKey, String... metricKeys) { - return newWsClient(orchestrator).measures().component(new ComponentWsRequest() + return newWsClient(orchestrator).measures().component(new ComponentRequest() .setComponentKey(componentKey) .setMetricKeys(asList(metricKeys)) .setAdditionalFields(singletonList("periods"))).getComponent().getMeasuresList() @@ -373,7 +373,7 @@ public class ItUtils { @CheckForNull public static Component getComponent(Orchestrator orchestrator, String componentKey) { try { - return newWsClient(orchestrator).components().show(new ShowWsRequest().setKey((componentKey))).getComponent(); + return newWsClient(orchestrator).components().show(new ShowRequest().setKey((componentKey))).getComponent(); } catch (org.sonarqube.ws.client.HttpException e) { if (e.code() == 404) { return null; @@ -405,7 +405,7 @@ public class ItUtils { newAdminWsClient(orchestrator) .qualityProfiles() .restoreProfile( - RestoreWsRequest.builder() + RestoreRequest.builder() .setBackup(new File(uri)) .setOrganization(organization) .build()); diff --git a/tests/src/test/java/util/issue/IssueRule.java b/tests/src/test/java/util/issue/IssueRule.java index 7857d3cabdc..c055a2b4385 100644 --- a/tests/src/test/java/util/issue/IssueRule.java +++ b/tests/src/test/java/util/issue/IssueRule.java @@ -25,7 +25,7 @@ import org.junit.rules.ExternalResource; import org.sonarqube.ws.Issues.Issue; import org.sonarqube.ws.Issues.SearchWsResponse; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.issue.SearchWsRequest; +import org.sonarqube.ws.client.issue.SearchRequest; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -47,24 +47,24 @@ public class IssueRule extends ExternalResource { return new IssueRule(requireNonNull(orchestrator, "Orchestrator instance can not be null")); } - public SearchWsResponse search(SearchWsRequest request) { + public SearchWsResponse search(SearchRequest request) { return adminWsClient().issues().search(request); } public Issue getRandomIssue() { - List issues = search(new SearchWsRequest()).getIssuesList(); + List issues = search(new SearchRequest()).getIssuesList(); assertThat(issues).isNotEmpty(); return issues.get(0); } public Issue getByKey(String issueKey) { - List issues = search(new SearchWsRequest().setIssues(singletonList(issueKey)).setAdditionalFields(singletonList("_all"))).getIssuesList(); + List issues = search(new SearchRequest().setIssues(singletonList(issueKey)).setAdditionalFields(singletonList("_all"))).getIssuesList(); assertThat(issues).hasSize(1); return issues.iterator().next(); } public List getByKeys(String... issueKeys) { - List issues = search(new SearchWsRequest().setIssues(asList(issueKeys)).setAdditionalFields(singletonList("_all"))).getIssuesList(); + List issues = search(new SearchRequest().setIssues(asList(issueKeys)).setAdditionalFields(singletonList("_all"))).getIssuesList(); assertThat(issues).hasSize(issueKeys.length); return issues; } diff --git a/tests/src/test/java/util/user/UserRule.java b/tests/src/test/java/util/user/UserRule.java index 9e8cc191020..9c2db03e6e7 100644 --- a/tests/src/test/java/util/user/UserRule.java +++ b/tests/src/test/java/util/user/UserRule.java @@ -35,12 +35,11 @@ import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.permission.AddUserWsRequest; +import org.sonarqube.ws.client.permission.AddUserRequest; import org.sonarqube.ws.client.roots.SetRootRequest; import org.sonarqube.ws.client.user.CreateRequest; import org.sonarqube.ws.client.user.SearchRequest; import org.sonarqube.ws.client.user.UsersService; -import org.sonarqube.ws.client.usergroups.AddUserRequest; import util.selenium.Consumer; import static java.util.Arrays.asList; @@ -148,8 +147,8 @@ public class UserRule extends ExternalResource implements GroupManagement { public String createAdminUser(String login, String password) { createUser(login, password); - adminWsClient.permissions().addUser(new AddUserWsRequest().setLogin(login).setPermission("admin")); - adminWsClient.userGroups().addUser(new AddUserRequest().setLogin(login).setName("sonar-administrators")); + adminWsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); + adminWsClient.userGroups().addUser(new org.sonarqube.ws.client.usergroups.AddUserRequest().setLogin(login).setName("sonar-administrators")); return login; }