import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
-import static org.apache.commons.lang.StringUtils.defaultString;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
import static org.sonar.core.util.stream.MoreCollectors.toList;
import static org.sonar.db.Pagination.forPage;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_ONLY_CURRENTS;
new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
new Change("6.6", "fields \"branch\" and \"branchType\" added"),
new Change("7.1", "field \"pullRequest\" added"),
- new Change("7.6", String.format("The use of module keys in parameters '%s' and '%s' is deprecated", TEXT_QUERY, PARAM_COMPONENT_QUERY)))
+ new Change("7.6", format("The use of module keys in parameters '%s' is deprecated", TEXT_QUERY)))
.setSince("5.2");
action.createParam(PARAM_COMPONENT_ID)
.setDescription("Id of the component (project) to filter on")
.setExampleValue(Uuids.UUID_EXAMPLE_03);
- action.createParam(PARAM_COMPONENT_QUERY)
- .setDescription(format("Limit search to: <ul>" +
- "<li>component names that contain the supplied string</li>" +
- "<li>component keys that are exactly the same as the supplied string</li>" +
- "</ul>" +
- "Must not be set together with %s.<br />" +
- "Deprecated and replaced by '%s'", PARAM_COMPONENT_ID, TEXT_QUERY))
- .setExampleValue("Apache")
- .setDeprecatedSince("5.5");
action.createParam(TEXT_QUERY)
.setDescription(format("Limit search to: <ul>" +
"<li>component names that contain the supplied string</li>" +
action.createParam(PARAM_MAX_EXECUTED_AT)
.setDescription("Maximum date of end of task processing (inclusive)")
.setExampleValue("2017-10-19T13:00:00+0200");
- action.createParam(Param.PAGE)
- .setDescription("Deprecated parameter")
- .setDeprecatedSince("5.5")
- .setDeprecatedKey("pageIndex", "5.4");
action.createPageSize(100, MAX_PAGE_SIZE);
}
private static Request toSearchWsRequest(org.sonar.api.server.ws.Request request) {
Request activityWsRequest = new Request()
.setComponentId(request.param(PARAM_COMPONENT_ID))
- .setQ(defaultString(request.param(TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY)))
+ .setQ(request.param(TEXT_QUERY))
.setStatus(request.paramAsStrings(PARAM_STATUS))
.setType(request.param(PARAM_TYPE))
.setMinSubmittedAt(request.param(PARAM_MIN_SUBMITTED_AT))
.setPs(String.valueOf(request.mandatoryParamAsInt(Param.PAGE_SIZE)));
checkRequest(activityWsRequest.getComponentId() == null || activityWsRequest.getQ() == null, "%s and %s must not be set at the same time",
- PARAM_COMPONENT_ID, PARAM_COMPONENT_QUERY);
+ PARAM_COMPONENT_ID, TEXT_QUERY);
return activityWsRequest;
}
private List<String> status;
private String type;
+ Request() {
+ // Nothing to do
+ }
+
/**
* Example value: "AU-TpxcA-iU5OvuD2FL0"
*/
- private Request setComponentId(String componentId) {
+ private Request setComponentId(@Nullable String componentId) {
this.componentId = componentId;
return this;
}
+ @CheckForNull
private String getComponentId() {
return componentId;
}
/**
* Example value: "2017-10-19T13:00:00+0200"
*/
- private Request setMaxExecutedAt(String maxExecutedAt) {
+ private Request setMaxExecutedAt(@Nullable String maxExecutedAt) {
this.maxExecutedAt = maxExecutedAt;
return this;
}
+ @CheckForNull
private String getMaxExecutedAt() {
return maxExecutedAt;
}
/**
* Example value: "2017-10-19T13:00:00+0200"
*/
- private Request setMinSubmittedAt(String minSubmittedAt) {
+ private Request setMinSubmittedAt(@Nullable String minSubmittedAt) {
this.minSubmittedAt = minSubmittedAt;
return this;
}
+ @CheckForNull
private String getMinSubmittedAt() {
return minSubmittedAt;
}
/**
* Example value: "Apache"
*/
- private Request setQ(String q) {
+ private Request setQ(@Nullable String q) {
this.q = q;
return this;
}
+ @CheckForNull
private String getQ() {
return q;
}
* <li>"IN_PROGRESS"</li>
* </ul>
*/
- private Request setStatus(List<String> status) {
+ private Request setStatus(@Nullable List<String> status) {
this.status = status;
return this;
}
+ @CheckForNull
private List<String> getStatus() {
return status;
}
* <li>"REPORT"</li>
* </ul>
*/
- private Request setType(String type) {
+ private Request setType(@Nullable String type) {
this.type = type;
return this;
}
+ @CheckForNull
private String getType() {
return type;
}
public static final String PARAM_COMPONENT_ID = "componentId";
public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
public static final String PARAM_COMPONENT = "component";
- public static final String PARAM_COMPONENT_QUERY = "componentQuery";
public static final String PARAM_TYPE = "type";
public static final String PARAM_STATUS = "status";
public static final String PARAM_ONLY_CURRENTS = "onlyCurrents";
@Override
protected void configureModule() {
add(
- ResourcesWs.class,
ComponentsWs.class,
// actions
AppAction.class,
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.component.ws;
-
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.RemovedWebServiceHandler;
-
-public class ResourcesWs implements WebService {
-
- @Override
- public void define(Context context) {
- NewController controller = context.createController("api/resources")
- .setDescription("Removed since 6.3, please use api/components and api/measures instead")
- .setSince("2.10");
- defineIndexAction(controller);
- controller.done();
- }
-
- private static void defineIndexAction(NewController controller) {
- controller.createAction("index")
- .setDescription("The web service is removed and you're invited to use the alternatives: " +
- "<ul>" +
- "<li>if you need one component without measures: api/components/show</li>" +
- "<li>if you need one component with measures: api/measures/component</li>" +
- "<li>if you need several components without measures: api/components/tree</li>" +
- "<li>if you need several components with measures: api/measures/component_tree</li>" +
- "</ul>")
- .setSince("2.10")
- .setDeprecatedSince("5.4")
- .setHandler(RemovedWebServiceHandler.INSTANCE)
- .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
- }
-
-}
import static org.sonar.core.util.stream.MoreCollectors.toList;
import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_IN_LAST;
boolean effectiveOnComponentOnly = false;
checkArgument(atMostOneNonNullElement(components, componentUuids, componentKeys, componentRootUuids, componentRoots),
- "At most one of the following parameters can be provided: %s, %s, %s, %s, %s",
- PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOTS, PARAM_COMPONENT_UUIDS);
+ "At most one of the following parameters can be provided: %s and %s", PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS);
if (componentRootUuids != null) {
allComponents.addAll(getComponentsFromUuids(session, componentRootUuids));
import com.google.common.base.Strings;
import com.google.common.io.Resources;
import java.util.Date;
-import java.util.Optional;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.apache.commons.lang.BooleanUtils;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.ws.Change;
import org.sonar.api.server.ws.Request;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ISSUE;
public class AssignAction implements IssuesWsAction {
- private static final String DEPRECATED_PARAM_ME = "me";
private static final String ASSIGN_TO_ME_VALUE = "_me";
private final System2 system2;
action.createParam(PARAM_ASSIGNEE)
.setDescription("Login of the assignee. When not set, it will unassign the issue. Use '%s' to assign to current user", ASSIGN_TO_ME_VALUE)
.setExampleValue("admin");
- action.createParam(DEPRECATED_PARAM_ME)
- .setDescription("(deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me")
- .setDeprecatedSince("5.2")
- .setBooleanPossibleValues();
}
@Override
try (DbSession dbSession = dbClient.openSession(false)) {
IssueDto issueDto = issueFinder.getByKey(dbSession, issueKey);
DefaultIssue issue = issueDto.toDefaultIssue();
- checkArgument(issue.type() != RuleType.SECURITY_HOTSPOT,"It is not allowed to assign a security hotspot");
+ checkArgument(issue.type() != RuleType.SECURITY_HOTSPOT, "Assigning security hotspots is not allowed");
UserDto user = getUser(dbSession, login);
if (user != null) {
checkMembership(dbSession, issueDto, user);
@CheckForNull
private String getAssignee(Request request) {
String assignee = emptyToNull(request.param(PARAM_ASSIGNEE));
- if (ASSIGN_TO_ME_VALUE.equals(assignee) || BooleanUtils.isTrue(request.paramAsBoolean(DEPRECATED_PARAM_ME))) {
- return userSession.getLogin();
- }
- return assignee;
+ return ASSIGN_TO_ME_VALUE.equals(assignee) ? userSession.getLogin() : assignee;
}
@CheckForNull
private void checkMembership(DbSession dbSession, IssueDto issueDto, UserDto user) {
String projectUuid = requireNonNull(issueDto.getProjectUuid());
- ComponentDto project = Optional.ofNullable(dbClient.componentDao().selectByUuid(dbSession, projectUuid).orElse(null))
+ ComponentDto project = dbClient.componentDao().selectByUuid(dbSession, projectUuid)
.orElseThrow(() -> new IllegalStateException(format("Unknown project %s", projectUuid)));
OrganizationDto organizationDto = dbClient.organizationDao().selectByUuid(dbSession, project.getOrganizationUuid())
.orElseThrow(() -> new IllegalStateException(format("Unknown organizationMember %s", project.getOrganizationUuid())));
import org.sonar.server.issue.AddTagsAction;
import org.sonar.server.issue.AssignAction;
import org.sonar.server.issue.IssueChangePostProcessor;
-import org.sonar.server.issue.WebIssueStorage;
import org.sonar.server.issue.RemoveTagsAction;
+import org.sonar.server.issue.WebIssueStorage;
import org.sonar.server.issue.notification.IssueChangeNotification;
import org.sonar.server.notification.NotificationManager;
import org.sonar.server.user.UserSession;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMMENT;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DO_TRANSITION;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ISSUES;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PLAN;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_REMOVE_TAGS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SEND_NOTIFICATIONS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SET_SEVERITY;
.setPossibleValues(RuleType.names())
.setSince("5.5")
.setDeprecatedKey("set_type.type", "6.2");
- action.createParam(PARAM_PLAN)
- .setDescription("In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan")
- .setDeprecatedSince("5.5");
action.createParam(PARAM_DO_TRANSITION)
.setDescription("Transition")
.setExampleValue(REOPEN)
import static org.sonar.server.ws.KeyExamples.KEY_PULL_REQUEST_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.DEPRECATED_PARAM_ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.DEPRECATED_PARAM_AUTHORS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE_COUNT;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_AUTHOR;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOTS;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOT_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AT;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PROJECTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PROJECT_KEYS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PULL_REQUEST;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_REPORTERS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLUTIONS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLVED;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RULES;
PARAM_SEVERITIES,
PARAM_STATUSES,
PARAM_RESOLUTIONS,
- DEPRECATED_PARAM_ACTION_PLANS,
PARAM_RULES,
PARAM_ASSIGNEES,
- PARAM_REPORTERS,
DEPRECATED_PARAM_AUTHORS,
PARAM_AUTHOR,
PARAM_DIRECTORIES,
.setHandler(this)
.setDescription(
"Search for issues.<br>" +
- "At most one of the following parameters can be provided at the same time: %s, %s, %s, %s, %s.<br>" +
+ "At most one of the following parameters can be provided at the same time: %s and %s.<br>" +
"Requires the 'Browse' permission on the specified project(s).",
- PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOT_UUIDS, PARAM_COMPONENT_ROOTS)
+ PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS)
.setSince("3.6")
.setChangelog(
new Change("7.7", format("Value '%s' in parameter '%s' is deprecated, please use '%s' instead", DEPRECATED_PARAM_AUTHORS, FACETS, PARAM_AUTHOR)),
private static void addComponentRelatedParams(WebService.NewAction action) {
action.createParam(PARAM_ON_COMPONENT_ONLY)
.setDescription("Return only issues at a component's level, not on its descendants (modules, directories, files, etc). " +
- "This parameter is only considered when componentKeys or componentUuids is set. " +
- "Using the deprecated componentRoots or componentRootUuids parameters will set this parameter to false. " +
- "Using the deprecated components parameter will set this parameter to true.")
+ "This parameter is only considered when componentKeys or componentUuids is set.")
.setBooleanPossibleValues()
.setDefaultValue("false");
"A component can be a portfolio, project, module, directory or file.")
.setExampleValue(KEY_PROJECT_EXAMPLE_001);
- action.createParam(PARAM_COMPONENTS)
- .setDeprecatedSince("5.1")
- .setDescription("If used, will have the same meaning as componentKeys AND onComponentOnly=true.");
-
action.createParam(PARAM_COMPONENT_UUIDS)
.setDescription("To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). " +
INTERNAL_PARAMETER_DISCLAIMER +
.setDeprecatedSince("6.5")
.setExampleValue("584a89f2-8037-4f7b-b82c-8b45d2d63fb2");
- action.createParam(PARAM_COMPONENT_ROOTS)
- .setDeprecatedSince("5.1")
- .setDescription("If used, will have the same meaning as componentKeys AND onComponentOnly=false.");
-
- action.createParam(PARAM_COMPONENT_ROOT_UUIDS)
- .setDeprecatedSince("5.1")
- .setDescription("If used, will have the same meaning as componentUuids AND onComponentOnly=false.");
-
action.createParam(PARAM_PROJECTS)
.setDescription("To retrieve issues associated to a specific list of projects (comma-separated list of project keys). " +
INTERNAL_PARAMETER_DISCLAIMER +
.setAssigneesUuid(getLogins(dbSession, request.paramAsStrings(PARAM_ASSIGNEES)))
.setAuthors(request.hasParam(PARAM_AUTHOR) ? request.multiParam(PARAM_AUTHOR) : request.paramAsStrings(DEPRECATED_PARAM_AUTHORS))
.setComponentKeys(request.paramAsStrings(PARAM_COMPONENT_KEYS))
- .setComponentRootUuids(request.paramAsStrings(PARAM_COMPONENT_ROOT_UUIDS))
- .setComponentRoots(request.paramAsStrings(PARAM_COMPONENT_ROOTS))
.setComponentUuids(request.paramAsStrings(PARAM_COMPONENT_UUIDS))
- .setComponents(request.paramAsStrings(PARAM_COMPONENTS))
.setCreatedAfter(request.param(PARAM_CREATED_AFTER))
.setCreatedAt(request.param(PARAM_CREATED_AT))
.setCreatedBefore(request.param(PARAM_CREATED_BEFORE))
import org.sonar.server.qualityprofile.QProfileTreeImpl;
import org.sonar.server.qualityprofile.RuleActivator;
import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
-import org.sonar.server.qualityprofile.ws.ProfilesWs;
import org.sonar.server.qualityprofile.ws.QProfilesWsModule;
import org.sonar.server.root.ws.RootWsModule;
import org.sonar.server.rule.CommonRuleDefinitionsImpl;
import org.sonar.server.telemetry.TelemetryClient;
import org.sonar.server.telemetry.TelemetryDaemon;
import org.sonar.server.telemetry.TelemetryDataLoader;
-import org.sonar.server.test.ws.TestsWs;
import org.sonar.server.text.MacroInterpreter;
import org.sonar.server.ui.DeprecatedViews;
import org.sonar.server.ui.PageDecorations;
XMLProfileSerializer.class,
AnnotationProfileParser.class,
QProfileComparison.class,
- ProfilesWs.class,
QProfileTreeImpl.class,
QProfileRulesImpl.class,
RuleActivator.class,
NotificationWsModule.class,
EmailsWsModule.class,
- // Tests
- TestsWs.class,
-
// Settings
PersistentSettings.class,
PropertiesWs.class,
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.qualityprofile.ws;
-
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.RemovedWebServiceHandler;
-
-/**
- * List of quality profiles WS implemented in Rails.
- * New WS on quality profiles MUST be declared in {@link org.sonar.server.qualityprofile.ws.QProfilesWs}
- */
-public class ProfilesWs implements WebService {
-
- public static final String API_ENDPOINT = "api/profiles";
-
- @Override
- public void define(Context context) {
- NewController controller = context.createController(API_ENDPOINT)
- .setDescription("Removed since 6.3, please use api/qualityprofiles instead")
- .setSince("4.4");
- defineListAction(controller);
- defineIndexAction(controller);
- controller.done();
- }
-
- private static void defineIndexAction(NewController controller) {
- controller.createAction("index")
- .setDescription("Get a profile.<br/>" +
- "The web service is removed and you're invited to use api/qualityprofiles/search instead")
- .setSince("3.3")
- .setDeprecatedSince("5.2")
- .setHandler(RemovedWebServiceHandler.INSTANCE)
- .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
- }
-
- private static void defineListAction(NewController controller) {
- controller.createAction("list")
- .setDescription("Get a list of profiles.<br/>" +
- "The web service is removed and you're invited to use api/qualityprofiles/search instead")
- .setSince("3.3")
- .setDeprecatedSince("5.2")
- .setHandler(RemovedWebServiceHandler.INSTANCE)
- .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample());
- }
-}
.setDescription("Key of the custom rule")
.setExampleValue("Todo_should_not_be_used");
- action
- .createParam("manual_key")
- .setDescription("Manual rules are no more supported. This parameter is ignored")
- .setExampleValue("Error_handling")
- .setDeprecatedSince("5.5");
-
action
.createParam(PARAM_TEMPLATE_KEY)
.setDescription("Key of the template rule in order to create a custom rule (mandatory for custom rule)")
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static java.util.Optional.ofNullable;
-import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
import static org.sonar.server.rule.ws.CreateAction.KEY_MAXIMUM_LENGTH;
import static org.sonar.server.rule.ws.CreateAction.NAME_MAXIMUM_LENGTH;
public static final String PARAM_TAGS = "tags";
public static final String PARAM_MARKDOWN_NOTE = "markdown_note";
public static final String PARAM_REMEDIATION_FN_TYPE = "remediation_fn_type";
- public static final String DEPRECATED_PARAM_REMEDIATION_FN_TYPE = "debt_remediation_fn_type";
public static final String PARAM_REMEDIATION_FN_BASE_EFFORT = "remediation_fn_base_effort";
- public static final String DEPRECATED_PARAM_REMEDIATION_FN_OFFSET = "debt_remediation_fn_offset";
public static final String PARAM_REMEDIATION_FN_GAP_MULTIPLIER = "remediation_fy_gap_multiplier";
- public static final String DEPRECATED_PARAM_REMEDIATION_FN_COEFF = "debt_remediation_fy_coeff";
public static final String PARAM_NAME = "name";
public static final String PARAM_DESCRIPTION = "markdown_description";
public static final String PARAM_SEVERITY = "severity";
.setPossibleValues(DebtRemediationFunction.Type.values())
.setSince("5.5");
- action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_TYPE)
- .setDeprecatedSince("5.5")
- .setPossibleValues(DebtRemediationFunction.Type.values());
-
action.createParam(PARAM_REMEDIATION_FN_BASE_EFFORT)
.setDescription("Base effort of the remediation function of the rule")
.setExampleValue("1d")
.setSince("5.5");
- action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET)
- .setDeprecatedSince("5.5");
-
action.createParam(PARAM_REMEDIATION_FN_GAP_MULTIPLIER)
.setDescription("Gap multiplier of the remediation function of the rule")
.setExampleValue("3min")
.setSince("5.5");
- action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_COEFF)
- .setDeprecatedSince("5.5");
-
action
.createParam(PARAM_NAME)
.setMaximumLength(NAME_MAXIMUM_LENGTH)
}
private static void readDebt(Request request, RuleUpdate update) {
- String value = defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_TYPE), request.param(DEPRECATED_PARAM_REMEDIATION_FN_TYPE));
+ String value = request.param(PARAM_REMEDIATION_FN_TYPE);
if (value != null) {
if (StringUtils.isBlank(value)) {
update.setDebtRemediationFunction(null);
} else {
DebtRemediationFunction fn = new DefaultDebtRemediationFunction(
DebtRemediationFunction.Type.valueOf(value),
- defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_GAP_MULTIPLIER), request.param(DEPRECATED_PARAM_REMEDIATION_FN_COEFF)),
- defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_BASE_EFFORT), request.param(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET)));
+ request.param(PARAM_REMEDIATION_FN_GAP_MULTIPLIER),
+ request.param(PARAM_REMEDIATION_FN_BASE_EFFORT));
update.setDebtRemediationFunction(fn);
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.test.ws;
-
-import org.sonar.api.server.ws.Change;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.RemovedWebServiceHandler;
-
-public class TestsWs implements WebService {
-
- @Override
- public void define(Context context) {
- NewController controller = context.createController("api/tests")
- .setSince("4.4")
- .setDescription("Removed in 7.6");
-
- controller.createAction("covered_files")
- .setDescription("This web API is no longer supported")
- .setSince("4.4")
- .setDeprecatedSince("5.6")
- .setChangelog(new Change("7.6", "This action has been removed"))
- .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample())
- .setHandler(RemovedWebServiceHandler.INSTANCE);
-
- controller
- .createAction("list")
- .setDescription("This web API is no longer supported")
- .setSince("5.2")
- .setDeprecatedSince("5.6")
- .setChangelog(new Change("7.6", "This action has been removed"))
- .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample())
- .setHandler(RemovedWebServiceHandler.INSTANCE);
-
- controller.done();
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.test.ws;
-
-import javax.annotation.ParametersAreNonnullByDefault;
package org.sonar.server.user.ws;
import com.google.common.collect.Multimap;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.function.Function;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.server.ws.Change;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.emptyToNull;
import static java.util.Optional.ofNullable;
-import static org.sonar.api.server.ws.WebService.Param.FIELDS;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.api.utils.Paging.forPageIndex;
import static org.sonar.core.util.stream.MoreCollectors.toList;
import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_ACTIVE;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_AVATAR;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EMAIL;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EXTERNAL_IDENTITY;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EXTERNAL_PROVIDER;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_GROUPS;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_LOCAL;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_NAME;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_SCM_ACCOUNTS;
-import static org.sonar.server.user.ws.UserJsonWriter.FIELD_TOKENS_COUNT;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.Users.SearchWsResponse.Groups;
import static org.sonarqube.ws.Users.SearchWsResponse.ScmAccounts;
.setHandler(this)
.setResponseExample(getClass().getResource("search-example.json"));
- action.createFieldsParam(UserJsonWriter.FIELDS)
- .setDeprecatedSince("5.4");
action.addPagingParams(50, MAX_LIMIT);
action.createParam(TEXT_QUERY)
private Users.SearchWsResponse doHandle(SearchRequest request) {
SearchOptions options = new SearchOptions().setPage(request.getPage(), request.getPageSize());
- List<String> fields = request.getPossibleFields();
SearchResult<UserDoc> result = userIndex.search(UserQuery.builder().setTextQuery(request.getQuery()).build(), options);
try (DbSession dbSession = dbClient.openSession(false)) {
List<String> logins = result.getDocs().stream().map(UserDoc::login).collect(toList());
List<UserDto> users = dbClient.userDao().selectByOrderedLogins(dbSession, logins);
Map<String, Integer> tokenCountsByLogin = dbClient.userTokenDao().countTokensByUsers(dbSession, users);
Paging paging = forPageIndex(request.getPage()).withPageSize(request.getPageSize()).andTotal((int) result.getTotal());
- return buildResponse(users, groupsByLogin, tokenCountsByLogin, fields, paging);
+ return buildResponse(users, groupsByLogin, tokenCountsByLogin, paging);
}
}
- private SearchWsResponse buildResponse(List<UserDto> users, Multimap<String, String> groupsByLogin, Map<String, Integer> tokenCountsByLogin,
- @Nullable List<String> fields, Paging paging) {
+ private SearchWsResponse buildResponse(List<UserDto> users, Multimap<String, String> groupsByLogin, Map<String, Integer> tokenCountsByLogin, Paging paging) {
SearchWsResponse.Builder responseBuilder = newBuilder();
- users.forEach(user -> responseBuilder.addUsers(towsUser(user, firstNonNull(tokenCountsByLogin.get(user.getUuid()), 0), groupsByLogin.get(user.getLogin()), fields)));
+ users.forEach(user -> responseBuilder.addUsers(towsUser(user, firstNonNull(tokenCountsByLogin.get(user.getUuid()), 0), groupsByLogin.get(user.getLogin()))));
responseBuilder.getPagingBuilder()
.setPageIndex(paging.pageIndex())
.setPageSize(paging.pageSize())
return responseBuilder.build();
}
- private User towsUser(UserDto user, @Nullable Integer tokensCount, Collection<String> groups, @Nullable Collection<String> fields) {
- User.Builder userBuilder = User.newBuilder()
- .setLogin(user.getLogin());
- setIfNeeded(FIELD_NAME, fields, user.getName(), userBuilder::setName);
+ private User towsUser(UserDto user, @Nullable Integer tokensCount, Collection<String> groups) {
+ User.Builder userBuilder = User.newBuilder().setLogin(user.getLogin());
+ ofNullable(user.getName()).ifPresent(userBuilder::setName);
if (userSession.isLoggedIn()) {
- setIfNeeded(FIELD_AVATAR, fields, emptyToNull(user.getEmail()), u -> userBuilder.setAvatar(avatarResolver.create(user)));
- setIfNeeded(FIELD_ACTIVE, fields, user.isActive(), userBuilder::setActive);
- setIfNeeded(FIELD_LOCAL, fields, user.isLocal(), userBuilder::setLocal);
- setIfNeeded(FIELD_EXTERNAL_PROVIDER, fields, user.getExternalIdentityProvider(), userBuilder::setExternalProvider);
- setIfNeeded(isNeeded(FIELD_SCM_ACCOUNTS, fields) && !user.getScmAccountsAsList().isEmpty(), user.getScmAccountsAsList(),
- scm -> userBuilder.setScmAccounts(ScmAccounts.newBuilder().addAllScmAccounts(scm)));
+ ofNullable(emptyToNull(user.getEmail())).ifPresent(u -> userBuilder.setAvatar(avatarResolver.create(user)));
+ userBuilder.setActive(user.isActive());
+ userBuilder.setLocal(user.isLocal());
+ ofNullable(user.getExternalIdentityProvider()).ifPresent(userBuilder::setExternalProvider);
+ if (!user.getScmAccountsAsList().isEmpty()) {
+ userBuilder.setScmAccounts(ScmAccounts.newBuilder().addAllScmAccounts(user.getScmAccountsAsList()));
+ }
}
if (userSession.isSystemAdministrator() || Objects.equals(userSession.getUuid(), user.getUuid())) {
- setIfNeeded(FIELD_EMAIL, fields, user.getEmail(), userBuilder::setEmail);
- setIfNeeded(isNeeded(FIELD_GROUPS, fields) && !groups.isEmpty(), groups,
- g -> userBuilder.setGroups(Groups.newBuilder().addAllGroups(g)));
- setIfNeeded(FIELD_EXTERNAL_IDENTITY, fields, user.getExternalLogin(), userBuilder::setExternalIdentity);
- setIfNeeded(FIELD_TOKENS_COUNT, fields, tokensCount, userBuilder::setTokensCount);
+ ofNullable(user.getEmail()).ifPresent(userBuilder::setEmail);
+ if (!groups.isEmpty()) {
+ userBuilder.setGroups(Groups.newBuilder().addAllGroups(groups));
+ }
+ ofNullable(user.getExternalLogin()).ifPresent(userBuilder::setExternalIdentity);
+ ofNullable(tokensCount).ifPresent(userBuilder::setTokensCount);
ofNullable(user.getLastConnectionDate()).ifPresent(date -> userBuilder.setLastConnectionDate(formatDateTime(date)));
}
return userBuilder.build();
}
- private static <PARAM> void setIfNeeded(String field, @Nullable Collection<String> fields, @Nullable PARAM parameter, Function<PARAM, ?> setter) {
- setIfNeeded(isNeeded(field, fields), parameter, setter);
- }
-
- private static <PARAM> void setIfNeeded(boolean condition, @Nullable PARAM parameter, Function<PARAM, ?> setter) {
- if (parameter != null && condition) {
- setter.apply(parameter);
- }
- }
-
- private static boolean isNeeded(String field, @Nullable Collection<String> fields) {
- return fields == null || fields.isEmpty() || fields.contains(field);
- }
-
private static SearchRequest toSearchRequest(Request request) {
int pageSize = request.mandatoryParamAsInt(PAGE_SIZE);
checkArgument(pageSize <= MAX_PAGE_SIZE, "The '%s' parameter must be less than %s", PAGE_SIZE, MAX_PAGE_SIZE);
.setQuery(request.param(TEXT_QUERY))
.setPage(request.mandatoryParamAsInt(PAGE))
.setPageSize(pageSize)
- .setPossibleFields(request.paramAsStrings(FIELDS))
.build();
}
private final Integer page;
private final Integer pageSize;
private final String query;
- private final List<String> possibleFields;
private SearchRequest(Builder builder) {
this.page = builder.page;
this.pageSize = builder.pageSize;
this.query = builder.query;
- this.possibleFields = builder.additionalFields;
}
@CheckForNull
return query;
}
- public List<String> getPossibleFields() {
- return possibleFields;
- }
-
public static Builder builder() {
return new Builder();
}
private Integer page;
private Integer pageSize;
private String query;
- private List<String> additionalFields = new ArrayList<>();
private Builder() {
// enforce factory method use
return this;
}
- public Builder setPossibleFields(List<String> possibleFields) {
- this.additionalFields = possibleFields;
- return this;
- }
-
public SearchRequest build() {
return new SearchRequest(this);
}
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.mockito.Mockito.mock;
+import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.api.utils.DateUtils.formatDate;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import static org.sonar.db.ce.CeActivityDto.Status.FAILED;
import static org.sonar.db.ce.CeTaskCharacteristicDto.PULL_REQUEST;
import static org.sonar.db.component.BranchType.LONG;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS;
insertActivity("T2", zookeeper, SUCCESS);
insertActivity("T3", eclipse, SUCCESS);
- ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac"));
+ ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac"));
assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T1", "T2");
}
logInAsSystemAdministrator();
insertActivity("T2", apacheView, SUCCESS);
- ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac"));
+ ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac"));
assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T2");
}
logInAsSystemAdministrator();
insertActivity("T2", apacheApp, SUCCESS);
- ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac"));
+ ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac"));
assertThat(activityResponse.getTasksList()).extracting(Task::getId).containsOnly("T2");
}
@Test
public void fail_if_both_filters_on_component_id_and_name() {
expectedException.expect(BadRequestException.class);
- expectedException.expectMessage("componentId and componentQuery must not be set at the same time");
+ expectedException.expectMessage("componentId and q must not be set at the same time");
ws.newRequest()
.setParam("componentId", "ID1")
- .setParam("componentQuery", "apache")
+ .setParam("q", "apache")
.setMediaType(MediaTypes.PROTOBUF)
.execute();
}
public void verify_count_of_added_components() {
ComponentContainer container = new ComponentContainer();
new ComponentsWsModule().configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 8);
+ assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 7);
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.component.ws;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.RemovedWebServiceHandler;
-import org.sonar.server.ws.WsTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ResourcesWsTest {
-
- WebService.Controller controller;
-
- @Before
- public void setUp() {
- WsTester tester = new WsTester(new ResourcesWs());
- controller = tester.controller("api/resources");
- }
-
- @Test
- public void define_controller() {
- assertThat(controller).isNotNull();
- assertThat(controller.since()).isEqualTo("2.10");
- assertThat(controller.description()).isNotEmpty();
- assertThat(controller.actions()).hasSize(1);
- }
-
- @Test
- public void define_index_action() {
- WebService.Action action = controller.action("index");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RemovedWebServiceHandler.class);
- assertThat(action.responseExampleAsString()).isNotEmpty();
- assertThat(action.params()).isEmpty();
- }
-
-}
@Test
public void fail_if_components_and_components_uuid_params_are_set_at_the_same_time() {
SearchRequest request = new SearchRequest()
- .setComponentKeys(asList("foo"))
- .setComponentUuids(asList("bar"));
+ .setComponentKeys(singletonList("foo"))
+ .setComponentUuids(singletonList("bar"));
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys, componentUuids, components, componentRoots, componentUuids");
+ expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys and componentUuids");
underTest.create(request);
}
@Test
public void fail_if_both_componentRoots_and_componentRootUuids_params_are_set() {
SearchRequest request = new SearchRequest()
- .setComponentRoots(asList("foo"))
- .setComponentRootUuids(asList("bar"));
+ .setComponentRoots(singletonList("foo"))
+ .setComponentRootUuids(singletonList("bar"));
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys, componentUuids, components, componentRoots, componentUuids");
+ expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys and componentUuids");
underTest.create(request);
}
import org.sonar.server.exceptions.UnauthorizedException;
import org.sonar.server.issue.IssueFieldsSetter;
import org.sonar.server.issue.IssueFinder;
-import org.sonar.server.issue.WebIssueStorage;
import org.sonar.server.issue.IssueUpdater;
import org.sonar.server.issue.TestIssueChangePostProcessor;
+import org.sonar.server.issue.WebIssueStorage;
import org.sonar.server.issue.index.IssueIndexer;
import org.sonar.server.issue.index.IssueIteratorFactory;
import org.sonar.server.notification.NotificationManager;
assertThat(issueChangePostProcessor.wasCalled()).isFalse();
}
- @Test
- public void assign_to_me_using_deprecated_me_param() {
- IssueDto issue = newIssueWithBrowsePermission();
-
- ws.newRequest()
- .setParam("issue", issue.getKey())
- .setParam("me", "true")
- .execute();
-
- checkIssueAssignee(issue.getKey(), CURRENT_USER_UUID);
- Optional<IssueDto> optionalIssueDto = dbClient.issueDao().selectByKey(session, issue.getKey());
- assertThat(optionalIssueDto).isPresent();
- assertThat(optionalIssueDto.get().getAssigneeUuid()).isEqualTo(CURRENT_USER_UUID);
- }
-
@Test
public void unassign() {
IssueDto issue = newIssueWithBrowsePermission();
UserDto arthur = insertUser("arthur");
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("It is not allowed to assign a security hotspot");
+ expectedException.expectMessage("Assigning security hotspots is not allowed");
ws.newRequest()
.setParam("issue", issueDto.getKey())
assertThat(action.key()).isEqualTo("bulk_change");
assertThat(action.isPost()).isTrue();
assertThat(action.isInternal()).isFalse();
- assertThat(action.params()).hasSize(10);
+ assertThat(action.params()).hasSize(9);
assertThat(action.responseExample()).isNotNull();
}
import static org.sonar.db.component.ComponentTesting.newView;
import static org.sonar.db.issue.IssueTesting.newIssue;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DIRECTORIES;
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENTS, file.getDbKey())
+ .setParam(PARAM_COMPONENT_KEYS, file.getKey())
.execute()
.assertJson(this.getClass(), "search_by_file_key.json");
ws.newRequest()
- .setParam(PARAM_COMPONENTS, unitTest.getDbKey())
+ .setParam(PARAM_COMPONENT_KEYS, unitTest.getKey())
.execute()
.assertJson(this.getClass(), "search_by_test_key.json");
}
import static org.sonar.server.tester.UserSessionRule.standalone;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
+import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_HIDE_COMMENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PAGE_INDEX;
session.commit();
indexIssues();
- ws.newRequest().setParam(PARAM_COMPONENTS, file.getDbKey()).execute()
+ ws.newRequest().setParam(PARAM_COMPONENT_KEYS, file.getKey()).execute()
.assertJson(this.getClass(), "apply_paging_with_one_component.json");
}
assertThat(def.responseExampleAsString()).isNotEmpty();
assertThat(def.params()).extracting("key").containsExactlyInAnyOrder(
- "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "componentRootUuids", "componentRoots", "componentUuids", "components", "branch",
+ "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "componentUuids", "branch",
"pullRequest", "organization",
"createdAfter", "createdAt", "createdBefore", "createdInLast", "directories", "facetMode", "facets", "fileUuids", "issues", "languages", "moduleUuids", "onComponentOnly",
"p", "projects", "ps", "resolutions", "resolved", "rules", "s", "severities", "sinceLeakPeriod",
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.qualityprofile.ws;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.RemovedWebServiceHandler;
-import org.sonar.server.ws.WsTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProfilesWsTest {
-
- private WsTester ws;
-
- @Before
- public void setUp() {
- ws = new WsTester(new ProfilesWs());
- }
-
- @Test
- public void define_controller() {
- WebService.Controller controller = controller();
- assertThat(controller).isNotNull();
- assertThat(controller.path()).isEqualTo("api/profiles");
- assertThat(controller.description()).isNotEmpty();
- assertThat(controller.actions()).hasSize(2);
- }
-
- @Test
- public void define_index_action() {
- WebService.Controller controller = ws.controller("api/profiles");
-
- WebService.Action restoreProfiles = controller.action("index");
- assertThat(restoreProfiles).isNotNull();
- assertThat(restoreProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class);
- assertThat(restoreProfiles.responseExampleAsString()).isNotEmpty();
- assertThat(restoreProfiles.params()).isEmpty();
- }
-
- @Test
- public void define_list_action() {
- WebService.Controller controller = controller();
-
- WebService.Action listProfiles = controller.action("list");
- assertThat(listProfiles).isNotNull();
- assertThat(listProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class);
- assertThat(listProfiles.responseExampleAsString()).isNotEmpty();
- assertThat(listProfiles.params()).isEmpty();
- }
-
- private WebService.Controller controller() {
- return ws.controller("api/profiles");
- }
-}
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.rule.RuleDefinitionDto;
import org.sonar.db.rule.RuleMetadataDto;
-import org.sonar.db.rule.RuleTesting;
import org.sonar.db.user.UserDto;
import org.sonar.server.es.EsClient;
import org.sonar.server.es.EsTester;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
import static org.sonar.db.rule.RuleTesting.setSystemTags;
import static org.sonar.db.rule.RuleTesting.setTags;
-import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_COEFF;
-import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_OFFSET;
-import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_TYPE;
import static org.sonar.server.rule.ws.UpdateAction.PARAM_KEY;
import static org.sonar.server.rule.ws.UpdateAction.PARAM_MARKDOWN_NOTE;
import static org.sonar.server.rule.ws.UpdateAction.PARAM_ORGANIZATION;
assertThat(ws.getDef().responseExampleAsString()).isNotNull();
assertThat(ws.getDef().description()).isNotNull();
}
-
+
@Test
public void update_custom_rule() {
logInAsQProfileAdministrator();
assertThat(metadataOfSpecificOrg.getRemediationBaseEffort()).isEqualTo(newEffort);
}
- @Test
- public void update_custom_rule_with_deprecated_remediation_function_parameters() {
- logInAsQProfileAdministrator();
-
- RuleDefinitionDto rule = RuleTesting.newRule()
- .setDefRemediationFunction(LINEAR_OFFSET.toString())
- .setDefRemediationGapMultiplier("10d")
- .setDefRemediationBaseEffort("5min");
- db.rules().insert(rule);
-
- String newType = LINEAR_OFFSET.toString();
- String newCoeff = "11d";
- String newOffset = "6min";
-
- Rules.UpdateResponse result = ws.newRequest().setMethod("POST")
- .setParam(PARAM_KEY, rule.getKey().toString())
- .setParam(DEPRECATED_PARAM_REMEDIATION_FN_TYPE, newType)
- .setParam(DEPRECATED_PARAM_REMEDIATION_FN_COEFF, newCoeff)
- .setParam(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET, newOffset)
- .executeProtobuf(Rules.UpdateResponse.class);
-
- Rules.Rule updatedRule = result.getRule();
- assertThat(updatedRule).isNotNull();
-
- assertThat(updatedRule.getKey()).isEqualTo(rule.getKey().toString());
- assertThat(updatedRule.getDefaultRemFnType()).isEqualTo(rule.getDefRemediationFunction());
- assertThat(updatedRule.getDefaultRemFnGapMultiplier()).isEqualTo(rule.getDefRemediationGapMultiplier());
- assertThat(updatedRule.getDefaultRemFnBaseEffort()).isEqualTo(rule.getDefRemediationBaseEffort());
- assertThat(updatedRule.getEffortToFixDescription()).isEqualTo(rule.getGapDescription());
-
- assertThat(updatedRule.getRemFnType()).isEqualTo(newType);
- assertThat(updatedRule.getDebtRemFnCoeff()).isEqualTo(newCoeff);
- assertThat(updatedRule.getDebtRemFnOffset()).isEqualTo(newOffset);
-
- assertThat(updatedRule.getRemFnType()).isEqualTo(newType);
- assertThat(updatedRule.getRemFnGapMultiplier()).isEqualTo(newCoeff);
- assertThat(updatedRule.getRemFnBaseEffort()).isEqualTo(newOffset);
- assertThat(updatedRule.getGapDescription()).isEqualTo(rule.getGapDescription());
- }
-
@Test
public void update_note() {
OrganizationDto organization = db.organizations().insert();
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.config.internal.MapSettings;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.internal.AlwaysIncreasingSystem2;
import org.sonar.db.DbTester;
.execute();
}
+ @Test
+ public void test_definition() {
+ WebService.Action action = tester.getDef();
+ assertThat(action).isNotNull();
+ assertThat(action.isPost()).isTrue();
+ assertThat(action.params()).hasSize(3);
+ }
+
private void createLocalUser() {
db.users().insertUser(newLocalUser("john", "John", "john@email.com"));
}
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.sonar.api.config.internal.MapSettings;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.internal.AlwaysIncreasingSystem2;
import org.sonar.core.config.CorePropertyDefinitions;
executeRequest("john");
}
+ @Test
+ public void test_definition() {
+ WebService.Action action = tester.getDef();
+ assertThat(action).isNotNull();
+ assertThat(action.isPost()).isTrue();
+ assertThat(action.params()).hasSize(7);
+ }
+
private CreateWsResponse executeRequest(String login) {
return call(CreateRequest.builder()
.setLogin(login)
import java.util.stream.IntStream;
import org.junit.Rule;
import org.junit.Test;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.System2;
import org.sonar.db.DbTester;
userSession.logIn(user);
assertThat(ws.newRequest().setParam("q", user.getLogin())
.executeProtobuf(SearchWsResponse.class).getUsersList())
- .extracting(User::getLogin, User::getName, User::getEmail, User::getExternalIdentity, User::getExternalProvider,
- User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::getTokensCount, User::hasLastConnectionDate)
- .containsExactlyInAnyOrder(
- tuple(user.getLogin(), user.getName(), user.getEmail(), user.getExternalLogin(), user.getExternalIdentityProvider(), true, true, true, 2, true));
+ .extracting(User::getLogin, User::getName, User::getEmail, User::getExternalIdentity, User::getExternalProvider,
+ User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::getTokensCount, User::hasLastConnectionDate)
+ .containsExactlyInAnyOrder(
+ tuple(user.getLogin(), user.getName(), user.getEmail(), user.getExternalLogin(), user.getExternalIdentityProvider(), true, true, true, 2, true));
userSession.logIn(otherUser);
assertThat(ws.newRequest().setParam("q", user.getLogin())
.executeProtobuf(SearchWsResponse.class).getUsersList())
- .extracting(User::getLogin, User::getName, User::hasEmail, User::hasExternalIdentity, User::hasExternalProvider,
- User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::hasTokensCount, User::hasLastConnectionDate)
- .containsExactlyInAnyOrder(
- tuple(user.getLogin(), user.getName(), false, false, true, true, true, false, false, false));
- }
-
- @Test
- public void search_with_fields() {
- UserDto user = db.users().insertUser();
- GroupDto group = db.users().insertGroup(db.getDefaultOrganization());
- db.users().insertMember(group, user);
- userIndexer.indexOnStartup(null);
- userSession.logIn().setSystemAdministrator();
-
- assertThat(ws.newRequest()
- .setParam(Param.FIELDS, "scmAccounts")
- .executeProtobuf(SearchWsResponse.class)
- .getUsersList())
- .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups)
- .containsExactlyInAnyOrder(tuple(user.getLogin(), false, true, false, false));
- assertThat(ws.newRequest()
- .setParam(Param.FIELDS, "groups")
- .executeProtobuf(SearchWsResponse.class)
- .getUsersList())
- .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups)
- .containsExactlyInAnyOrder(tuple(user.getLogin(), false, false, false, true));
- assertThat(ws.newRequest()
- .setParam(Param.FIELDS, "")
- .executeProtobuf(SearchWsResponse.class)
- .getUsersList())
- .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups)
- .containsExactlyInAnyOrder(tuple(user.getLogin(), true, true, true, true));
- assertThat(ws.newRequest()
- .executeProtobuf(SearchWsResponse.class)
- .getUsersList())
- .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups)
- .containsExactlyInAnyOrder(tuple(user.getLogin(), true, true, true, true));
+ .extracting(User::getLogin, User::getName, User::hasEmail, User::hasExternalIdentity, User::hasExternalProvider,
+ User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::hasTokensCount, User::hasLastConnectionDate)
+ .containsExactlyInAnyOrder(
+ tuple(user.getLogin(), user.getName(), false, false, true, true, true, false, false, false));
}
@Test
assertJson(response).isSimilarTo(getClass().getResource("search-example.json"));
}
+ @Test
+ public void test_definition() {
+ WebService.Action action = ws.getDef();
+ assertThat(action).isNotNull();
+ assertThat(action.isPost()).isFalse();
+ assertThat(action.responseExampleAsString()).isNotEmpty();
+ assertThat(action.params()).hasSize(3);
+ }
+
}
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.config.internal.MapSettings;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.System2;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
.execute();
}
+ @Test
+ public void test_definition() {
+ WebService.Action action = ws.getDef();
+ assertThat(action).isNotNull();
+ assertThat(action.isPost()).isTrue();
+ assertThat(action.params()).hasSize(5);
+ }
+
private void createUser() {
UserDto userDto = newUserDto()
.setEmail("john@email.com")
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.user.ws;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbTester;
-import org.sonar.server.authentication.CredentialsLocalAuthentication;
-import org.sonar.server.issue.ws.AvatarResolver;
-import org.sonar.server.tester.UserSessionRule;
-import org.sonar.server.user.UserUpdater;
-import org.sonar.server.user.index.UserIndex;
-import org.sonar.server.ws.WsTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class UsersWsTest {
- @Rule
- public UserSessionRule userSessionRule = UserSessionRule.standalone();
- @Rule
- public DbTester db = DbTester.create();
-
- private WebService.Controller controller;
- private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-
- @Before
- public void setUp() {
- WsTester tester = new WsTester(new UsersWs(
- new CreateAction(mock(DbClient.class), mock(UserUpdater.class), userSessionRule),
- new UpdateAction(mock(UserUpdater.class), userSessionRule, mock(UserJsonWriter.class), mock(DbClient.class)),
- new ChangePasswordAction(mock(DbClient.class), mock(UserUpdater.class), userSessionRule, localAuthentication),
- new SearchAction(userSessionRule, mock(UserIndex.class), mock(DbClient.class), mock(AvatarResolver.class))));
- controller = tester.controller("api/users");
- }
-
- @Test
- public void define_controller() {
- assertThat(controller).isNotNull();
- assertThat(controller.description()).isNotEmpty();
- assertThat(controller.since()).isEqualTo("3.6");
- assertThat(controller.actions()).hasSize(4);
- }
-
- @Test
- public void define_search_action() {
- WebService.Action action = controller.action("search");
- assertThat(action).isNotNull();
- assertThat(action.isPost()).isFalse();
- assertThat(action.responseExampleAsString()).isNotEmpty();
- assertThat(action.params()).hasSize(4);
- }
-
- @Test
- public void define_create_action() {
- WebService.Action action = controller.action("create");
- assertThat(action).isNotNull();
- assertThat(action.isPost()).isTrue();
- assertThat(action.params()).hasSize(7);
- }
-
- @Test
- public void define_update_action() {
- WebService.Action action = controller.action("update");
- assertThat(action).isNotNull();
- assertThat(action.isPost()).isTrue();
- assertThat(action.params()).hasSize(5);
- }
-
- @Test
- public void define_change_password_action() {
- WebService.Action action = controller.action("change_password");
- assertThat(action).isNotNull();
- assertThat(action.isPost()).isTrue();
- assertThat(action.params()).hasSize(3);
- }
-
-}
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
import org.sonarqube.ws.client.plugins.PluginsService;
-import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbadges.ProjectBadgesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
-import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
import org.sonarqube.ws.client.securityreports.SecurityReportsService;
private final OrganizationsService organizationsService;
private final PermissionsService permissionsService;
private final PluginsService pluginsService;
- private final ProfilesService profilesService;
private final ProjectAnalysesService projectAnalysesService;
private final ProjectBadgesService projectBadgesService;
private final ProjectBranchesService projectBranchesService;
private final PropertiesService propertiesService;
private final QualitygatesService qualitygatesService;
private final QualityprofilesService qualityprofilesService;
- private final ResourcesService resourcesService;
private final RootsService rootsService;
private final RulesService rulesService;
private final ServerService serverService;
this.organizationsService = new OrganizationsService(wsConnector);
this.permissionsService = new PermissionsService(wsConnector);
this.pluginsService = new PluginsService(wsConnector);
- this.profilesService = new ProfilesService(wsConnector);
this.projectAnalysesService = new ProjectAnalysesService(wsConnector);
this.projectBadgesService = new ProjectBadgesService(wsConnector);
this.projectBranchesService = new ProjectBranchesService(wsConnector);
this.propertiesService = new PropertiesService(wsConnector);
this.qualitygatesService = new QualitygatesService(wsConnector);
this.qualityprofilesService = new QualityprofilesService(wsConnector);
- this.resourcesService = new ResourcesService(wsConnector);
this.rootsService = new RootsService(wsConnector);
this.rulesService = new RulesService(wsConnector);
this.serverService = new ServerService(wsConnector);
return pluginsService;
}
- @Override
- public ProfilesService profiles() {
- return profilesService;
- }
-
@Override
public ProjectAnalysesService projectAnalyses() {
return projectAnalysesService;
return qualityprofilesService;
}
- @Override
- public ResourcesService resources() {
- return resourcesService;
- }
-
@Override
public RootsService roots() {
return rootsService;
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
import org.sonarqube.ws.client.plugins.PluginsService;
-import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbadges.ProjectBadgesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
-import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
import org.sonarqube.ws.client.securityreports.SecurityReportsService;
PluginsService plugins();
- ProfilesService profiles();
-
ProjectAnalysesService projectAnalyses();
ProjectBadgesService projectBadges();
QualityprofilesService qualityprofiles();
- ResourcesService resources();
-
RootsService roots();
RulesService rules();
public class ActivityRequest {
private String componentId;
- private String componentQuery;
private String maxExecutedAt;
private String minSubmittedAt;
private String onlyCurrents;
- private String p;
private String ps;
private String q;
private List<String> status;
return componentId;
}
- /**
- * Example value: "Apache"
- * @deprecated since 5.5
- */
- @Deprecated
- public ActivityRequest setComponentQuery(String componentQuery) {
- this.componentQuery = componentQuery;
- return this;
- }
-
- public String getComponentQuery() {
- return componentQuery;
- }
-
/**
* Example value: "2017-10-19T13:00:00+0200"
*/
return onlyCurrents;
}
- /**
- * @deprecated since 5.5
- */
- @Deprecated
- public ActivityRequest setP(String p) {
- this.p = p;
- return this;
- }
-
- public String getP() {
- return p;
- }
-
/**
* Example value: "20"
*/
return call(
new GetRequest(path("activity"))
.setParam("componentId", request.getComponentId())
- .setParam("componentQuery", request.getComponentQuery())
.setParam("maxExecutedAt", request.getMaxExecutedAt())
.setParam("minSubmittedAt", request.getMinSubmittedAt())
.setParam("onlyCurrents", request.getOnlyCurrents())
- .setParam("p", request.getP())
.setParam("ps", request.getPs())
.setParam("q", request.getQ())
.setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(",")))
public static final String PARAM_STATUSES = "statuses";
public static final String PARAM_RESOLUTIONS = "resolutions";
public static final String PARAM_RESOLVED = "resolved";
- public static final String PARAM_COMPONENTS = "components";
public static final String PARAM_COMPONENT_KEYS = "componentKeys";
public static final String PARAM_COMPONENT_UUIDS = "componentUuids";
- public static final String PARAM_COMPONENT_ROOTS = "componentRoots";
- public static final String PARAM_COMPONENT_ROOT_UUIDS = "componentRootUuids";
public static final String PARAM_MODULE_UUIDS = "moduleUuids";
public static final String PARAM_PROJECTS = "projects";
public static final String PARAM_PROJECT_KEYS = "projectKeys";
public static final String PARAM_ASSIGN = "assign";
public static final String PARAM_SET_SEVERITY = "set_severity";
public static final String PARAM_SET_TYPE = "set_type";
- public static final String PARAM_PLAN = "plan";
public static final String PARAM_DO_TRANSITION = "do_transition";
public static final String PARAM_ADD_TAGS = "add_tags";
public static final String PARAM_REMOVE_TAGS = "remove_tags";
public static final String PARAM_SEND_NOTIFICATIONS = "sendNotifications";
-
- /**
- * @deprecated since 5.5, action plan feature has been removed
- */
- @Deprecated
- public static final String DEPRECATED_PARAM_ACTION_PLANS = "actionPlans";
-
- /**
- * @deprecated since 5.5, manual issue feature has been dropped.
- */
- @Deprecated
- public static final String PARAM_REPORTERS = "reporters";
public static final String PARAM_ASSIGNEES = "assignees";
/**
public static final String PARAM_SANS_TOP_25 = "sansTop25";
public static final String PARAM_CWE = "cwe";
public static final String PARAM_ASSIGNED = "assigned";
-
- /**
- * @deprecated since 5.5, action plan feature has been removed
- */
- @Deprecated
- public static final String PARAM_PLANNED = "planned";
public static final String PARAM_HIDE_COMMENTS = "hideComments";
public static final String PARAM_CREATED_AFTER = "createdAfter";
public static final String PARAM_CREATED_AT = "createdAt";
private String assignee;
private String issue;
- private String me;
/**
* Example value: "admin"
return issue;
}
- /**
- * Possible values:
- * <ul>
- * <li>"true"</li>
- * <li>"false"</li>
- * <li>"yes"</li>
- * <li>"no"</li>
- * </ul>
- * @deprecated since 5.2
- */
- @Deprecated
- public AssignRequest setMe(String me) {
- this.me = me;
- return this;
- }
-
- public String getMe() {
- return me;
- }
}
private List<String> comment;
private String doTransition;
private List<String> issues;
- private List<String> plan;
private String removeTags;
private String sendNotifications;
private List<String> setSeverity;
return issues;
}
- /**
- * @deprecated since 5.5
- */
- @Deprecated
- public BulkChangeRequest setPlan(List<String> plan) {
- this.plan = plan;
- return this;
- }
-
- public List<String> getPlan() {
- return plan;
- }
-
/**
* Example value: "security,java8"
*/
return call(
new PostRequest(path("assign"))
.setParam("assignee", request.getAssignee())
- .setParam("issue", request.getIssue())
- .setParam("me", request.getMe()),
+ .setParam("issue", request.getIssue()),
AssignResponse.parser());
}
.setParam("comment", request.getComment() == null ? null : request.getComment().stream().collect(Collectors.joining(",")))
.setParam("do_transition", request.getDoTransition())
.setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(",")))
- .setParam("plan", request.getPlan() == null ? null : request.getPlan().stream().collect(Collectors.joining(",")))
.setParam("remove_tags", request.getRemoveTags())
.setParam("sendNotifications", request.getSendNotifications())
.setParam("set_severity", request.getSetSeverity() == null ? null : request.getSetSeverity().stream().collect(Collectors.joining(",")))
.setParam("authors", request.getAuthors() == null ? null : request.getAuthors().stream().collect(Collectors.joining(",")))
.setParam("branch", request.getBranch())
.setParam("componentKeys", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(",")))
- .setParam("componentRootUuids", request.getComponentRootUuids())
- .setParam("componentRoots", request.getComponentRoots())
.setParam("componentUuids", request.getComponentUuids() == null ? null : request.getComponentUuids().stream().collect(Collectors.joining(",")))
- .setParam("components", request.getComponents())
.setParam("createdAfter", request.getCreatedAfter())
.setParam("createdAt", request.getCreatedAt())
.setParam("createdBefore", request.getCreatedBefore())
private List<String> authors;
private String branch;
private List<String> componentKeys;
- private String componentRootUuids;
- private String componentRoots;
private List<String> componentUuids;
- private String components;
private String createdAfter;
private String createdAt;
private String createdBefore;
return componentKeys;
}
- /**
- * @deprecated since 5.1
- */
- @Deprecated
- public SearchRequest setComponentRootUuids(String componentRootUuids) {
- this.componentRootUuids = componentRootUuids;
- return this;
- }
-
- public String getComponentRootUuids() {
- return componentRootUuids;
- }
-
- /**
- * @deprecated since 5.1
- */
- @Deprecated
- public SearchRequest setComponentRoots(String componentRoots) {
- this.componentRoots = componentRoots;
- return this;
- }
-
- public String getComponentRoots() {
- return componentRoots;
- }
-
/**
* Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2"
* @deprecated since 6.5
return componentUuids;
}
- /**
- * @deprecated since 5.1
- */
- @Deprecated
- public SearchRequest setComponents(String components) {
- this.components = components;
- return this;
- }
-
- public String getComponents() {
- return components;
- }
-
/**
* Example value: "2017-10-19 or 2017-10-19T13:00:00+0200"
*/
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.profiles;
-
-import java.util.stream.Collectors;
-import javax.annotation.Generated;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-/**
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles">Further information about this web service online</a>
- */
-@Generated("sonar-ws-generator")
-public class ProfilesService extends BaseService {
-
- public ProfilesService(WsConnector wsConnector) {
- super(wsConnector, "api/profiles");
- }
-
- /**
- *
- * This is part of the internal API.
- * This is a GET request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles/index">Further information about this action online (including a response example)</a>
- * @since 3.3
- * @deprecated since 5.2
- */
- @Deprecated
- public String index() {
- return call(
- new GetRequest(path("index"))
- .setMediaType(MediaTypes.JSON)
- ).content();
- }
-
- /**
- *
- * This is part of the internal API.
- * This is a GET request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles/list">Further information about this action online (including a response example)</a>
- * @since 3.3
- * @deprecated since 5.2
- */
- @Deprecated
- public String list() {
- return call(
- new GetRequest(path("list"))
- .setMediaType(MediaTypes.JSON)
- ).content();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-@Generated("sonar-ws-generator")
-package org.sonarqube.ws.client.profiles;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-import javax.annotation.Generated;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.resources;
-
-import javax.annotation.Generated;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-/**
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/resources">Further information about this web service online</a>
- */
-@Generated("sonar-ws-generator")
-public class ResourcesService extends BaseService {
-
- public ResourcesService(WsConnector wsConnector) {
- super(wsConnector, "api/resources");
- }
-
- /**
- *
- * This is part of the internal API.
- * This is a GET request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/resources/index">Further information about this action online (including a response example)</a>
- * @since 2.10
- * @deprecated since 5.4
- */
- @Deprecated
- public String index() {
- return call(
- new GetRequest(path("index"))
- .setMediaType(MediaTypes.JSON)
- ).content();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-@Generated("sonar-ws-generator")
-package org.sonarqube.ws.client.resources;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-import javax.annotation.Generated;
-
public class CreateRequest {
private String customKey;
- private String manualKey;
private String markdownDescription;
private String name;
private List<String> params;
return customKey;
}
- /**
- * Example value: "Error_handling"
- * @deprecated since 5.5
- */
- @Deprecated
- public CreateRequest setManualKey(String manualKey) {
- this.manualKey = manualKey;
- return this;
- }
-
- public String getManualKey() {
- return manualKey;
- }
-
/**
* This is a mandatory parameter.
* Example value: "Description of my custom rule"
call(
new PostRequest(path("create"))
.setParam("custom_key", request.getCustomKey())
- .setParam("manual_key", request.getManualKey())
.setParam("markdown_description", request.getMarkdownDescription())
.setParam("name", request.getName())
.setParam("params", request.getParams() == null ? null : request.getParams().stream().collect(Collectors.joining(",")))
public void update(UpdateRequest request) {
call(
new PostRequest(path("update"))
- .setParam("debt_remediation_fn_offset", request.getDebtRemediationFnOffset())
- .setParam("debt_remediation_fn_type", request.getDebtRemediationFnType())
- .setParam("debt_remediation_fy_coeff", request.getDebtRemediationFyCoeff())
- .setParam("debt_sub_characteristic", request.getDebtSubCharacteristic())
.setParam("key", request.getKey())
.setParam("markdown_description", request.getMarkdownDescription())
.setParam("markdown_note", request.getMarkdownNote())
@Generated("sonar-ws-generator")
public class UpdateRequest {
- private String debtRemediationFnOffset;
- private String debtRemediationFnType;
- private String debtRemediationFyCoeff;
- private String debtSubCharacteristic;
private String key;
private String markdownDescription;
private String markdownNote;
private String status;
private List<String> tags;
- /**
- * @deprecated since 5.5
- */
- @Deprecated
- public UpdateRequest setDebtRemediationFnOffset(String debtRemediationFnOffset) {
- this.debtRemediationFnOffset = debtRemediationFnOffset;
- return this;
- }
-
- public String getDebtRemediationFnOffset() {
- return debtRemediationFnOffset;
- }
-
- /**
- * Possible values:
- * <ul>
- * <li>"LINEAR"</li>
- * <li>"LINEAR_OFFSET"</li>
- * <li>"CONSTANT_ISSUE"</li>
- * </ul>
- * @deprecated since 5.5
- */
- @Deprecated
- public UpdateRequest setDebtRemediationFnType(String debtRemediationFnType) {
- this.debtRemediationFnType = debtRemediationFnType;
- return this;
- }
-
- public String getDebtRemediationFnType() {
- return debtRemediationFnType;
- }
-
- /**
- * @deprecated since 5.5
- */
- @Deprecated
- public UpdateRequest setDebtRemediationFyCoeff(String debtRemediationFyCoeff) {
- this.debtRemediationFyCoeff = debtRemediationFyCoeff;
- return this;
- }
-
- public String getDebtRemediationFyCoeff() {
- return debtRemediationFyCoeff;
- }
-
- /**
- * @deprecated since 5.5
- */
- @Deprecated
- public UpdateRequest setDebtSubCharacteristic(String debtSubCharacteristic) {
- this.debtSubCharacteristic = debtSubCharacteristic;
- return this;
- }
-
- public String getDebtSubCharacteristic() {
- return debtSubCharacteristic;
- }
-
/**
* This is a mandatory parameter.
* Example value: "javascript:NullCheck"
@Generated("sonar-ws-generator")
public class SearchRequest {
- private List<String> f;
private String p;
private String ps;
private String q;
- /**
- * Possible values:
- * <ul>
- * <li>"name"</li>
- * <li>"email"</li>
- * <li>"avatart"</li>
- * <li>"scmAccounts"</li>
- * <li>"groups"</li>
- * <li>"active"</li>
- * <li>"local"</li>
- * <li>"externalIdentity"</li>
- * <li>"externalProvider"</li>
- * </ul>
- * @deprecated since 5.4
- */
- @Deprecated
- public SearchRequest setF(List<String> f) {
- this.f = f;
- return this;
- }
-
- public List<String> getF() {
- return f;
- }
-
/**
* Example value: "42"
*/
public SearchWsResponse search(SearchRequest request) {
return call(
new GetRequest(path("search"))
- .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(",")))
.setParam("p", request.getP())
.setParam("ps", request.getPs())
.setParam("q", request.getQ()),