import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
import static org.sonar.api.web.UserRole.USER;
import static org.sonar.db.newcodeperiod.NewCodePeriodType.REFERENCE_BRANCH;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
+import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
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(componentKeys, componentUuids),
- "At most one of the following parameters can be provided: %s and %s", PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS);
+ "At most one of the following parameters can be provided: %s and %s", PARAM_COMPONENTS, PARAM_COMPONENT_UUIDS);
if (componentKeys != null) {
allComponents.addAll(getComponentsFromKeys(session, componentKeys, branch, pullRequest));
assertThatThrownBy(() -> underTest.create(request))
.isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("At most one of the following parameters can be provided: componentKeys and componentUuids");
+ .hasMessageContaining("At most one of the following parameters can be provided: components and componentUuids");
}
@Test
import static org.sonar.db.component.ComponentTesting.newFileDto;
import static org.sonar.db.component.ComponentTesting.newProjectCopy;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
+import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DIRECTORIES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_FILES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_IN_NEW_CODE_PERIOD;
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.execute()
.assertJson(this.getClass(), "search_since_leak_period.json");
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, file.getKey())
+ .setParam(PARAM_COMPONENTS, file.getKey())
.execute()
.assertJson(this.getClass(), "search_by_file_key.json");
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, unitTest.getKey())
+ .setParam(PARAM_COMPONENTS, unitTest.getKey())
.execute()
.assertJson(this.getClass(), "search_by_test_key.json");
}
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, directory.getKey())
+ .setParam(PARAM_COMPONENTS, directory.getKey())
.execute()
.assertJson(this.getClass(), "search_by_file_uuid.json");
indexIssuesAndViews();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, view.getKey())
+ .setParam(PARAM_COMPONENTS, view.getKey())
.execute()
.assertJson(this.getClass(), "search_by_view_uuid.json");
}
indexIssuesAndViews();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, subView.getKey())
+ .setParam(PARAM_COMPONENTS, subView.getKey())
.execute()
.assertJson(this.getClass(), "search_by_view_uuid.json");
}
indexIssuesAndViews();
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, subView.getKey())
+ .setParam(PARAM_COMPONENTS, subView.getKey())
.execute()
.assertJson(this.getClass(), "no_issue.json");
}
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.executeProtobuf(SearchWsResponse.class);
assertThat(result.getIssuesList()).extracting(Issue::getKey)
// All issues on applicationBranch1
assertThat(ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, applicationBranch1.getKey())
+ .setParam(PARAM_COMPONENTS, applicationBranch1.getKey())
.setParam(PARAM_BRANCH, appBranch1)
.executeProtobuf(SearchWsResponse.class).getIssuesList())
.extracting(Issue::getKey, Issue::getComponent, Issue::getProject, Issue::getBranch, Issue::hasBranch)
// Issues on project1Branch1
assertThat(ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, applicationBranch1.getKey())
+ .setParam(PARAM_COMPONENTS, applicationBranch1.getKey())
.setParam(PARAM_PROJECTS, project1.getKey())
.setParam(PARAM_BRANCH, appBranch1)
.executeProtobuf(SearchWsResponse.class).getIssuesList())
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.executeProtobuf(SearchWsResponse.class);
assertThat(result.getIssuesList()).isEmpty();
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.executeProtobuf(SearchWsResponse.class);
assertThat(result.getIssuesList()).isEmpty();
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.executeProtobuf(SearchWsResponse.class);
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.setParam(PARAM_PROJECTS, project1.getKey())
.executeProtobuf(SearchWsResponse.class);
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.setParam(PARAM_PROJECTS, project1.getKey())
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.executeProtobuf(SearchWsResponse.class);
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+ .setParam(PARAM_COMPONENTS, application.getKey())
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.executeProtobuf(SearchWsResponse.class);
// On component key + branch
assertThat(ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(PARAM_BRANCH, branchName)
.executeProtobuf(SearchWsResponse.class).getIssuesList())
.extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
.containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchName));
// On file key + branch
assertThat(ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, branchFile.getKey())
+ .setParam(PARAM_COMPONENTS, branchFile.getKey())
.setParam(PARAM_BRANCH, branchName)
.executeProtobuf(SearchWsResponse.class).getIssuesList())
.extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, branch.getKey())
+ .setParam(PARAM_COMPONENTS, branch.getKey())
.setParam(PARAM_BRANCH, branchName)
.executeProtobuf(SearchWsResponse.class);
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, pullRequest.getKey())
+ .setParam(PARAM_COMPONENTS, pullRequest.getKey())
.setParam(PARAM_PULL_REQUEST, pullRequestKey)
.executeProtobuf(SearchWsResponse.class);
indexIssuesAndViews();
SearchWsResponse result = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(PARAM_BRANCH, DEFAULT_MAIN_BRANCH_NAME)
.executeProtobuf(SearchWsResponse.class);
import static org.sonar.db.component.ComponentTesting.newDirectory;
import static org.sonar.db.component.ComponentTesting.newFileDto;
import static org.sonar.server.tester.UserSessionRule.standalone;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
+import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_FILES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PROJECTS;
indexIssues();
SearchWsResponse response = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(FACETS, "severities,statuses,resolutions,rules,types,languages,projects,files,assignees")
.executeProtobuf(SearchWsResponse.class);
SearchWsResponse response = ws.newRequest()
.setParam("resolved", "false")
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(WebService.Param.FACETS, "directories")
.executeProtobuf(SearchWsResponse.class);
indexIssues();
SearchWsResponse response = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(PARAM_FILES, file1.path())
.setParam(WebService.Param.FACETS, "files")
.executeProtobuf(SearchWsResponse.class);
indexIssues();
SearchWsResponse response = ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, project.getKey())
+ .setParam(PARAM_COMPONENTS, project.getKey())
.setParam(FACETS, "files,directories,statuses,resolutions,severities,types,rules,languages,assignees")
.executeProtobuf(SearchWsResponse.class);
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ADDITIONAL_FIELDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CODE_VARIANTS;
-import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
+import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS;
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_IN_NEW_CODE_PERIOD;
session.commit();
indexIssues();
- ws.newRequest().setParam(PARAM_COMPONENT_KEYS, file.getKey()).execute()
+ ws.newRequest().setParam(PARAM_COMPONENTS, file.getKey()).execute()
.assertJson(this.getClass(), "apply_paging_with_one_component.json");
}
ws.newRequest()
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
- .setParam(PARAM_COMPONENT_KEYS, "PROJECT_KEY")
+ .setParam(PARAM_COMPONENTS, "PROJECT_KEY")
.execute()
.assertJson(this.getClass(), "filter_by_leak_period.json");
userSession.logIn(john);
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, "PROJECT_KEY")
+ .setParam(PARAM_COMPONENTS, "PROJECT_KEY")
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.execute()
.assertJson(this.getClass(), "empty_result.json");
userSession.logIn(john);
ws.newRequest()
- .setParam(PARAM_COMPONENT_KEYS, "PROJECT_KEY")
+ .setParam(PARAM_COMPONENTS, "PROJECT_KEY")
.setParam(PARAM_PULL_REQUEST, "pr")
.setParam(PARAM_IN_NEW_CODE_PERIOD, "true")
.execute()
public void empty_search_with_unknown_branch() {
SearchWsResponse response = ws.newRequest()
.setParam("onComponentOnly", "true")
- .setParam("componentKeys", "foo")
+ .setParam("components", "foo")
.setParam("branch", "bar")
.executeProtobuf(SearchWsResponse.class);
assertThat(def.responseExampleAsString()).isNotEmpty();
assertThat(def.params()).extracting("key").containsExactlyInAnyOrder(
- "additionalFields", "asc", "assigned", "assignees", "author", "componentKeys", "branch", "pullRequest", "createdAfter", "createdAt",
+ "additionalFields", "asc", "assigned", "assignees", "author", "components", "branch", "pullRequest", "createdAfter", "createdAt",
"createdBefore", "createdInLast", "directories", "facets", "files", "issues", "scopes", "languages", "onComponentOnly",
"p", "projects", "ps", "resolutions", "resolved", "rules", "s", "severities", "statuses", "tags", "types", "pciDss-3.2", "pciDss-4.0", "owaspAsvs-4.0",
"owaspAsvsLevel", "owaspTop10",
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_CODE_VARIANTS;
+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_CREATED_AT;
+ "<br/>When issue indexation is in progress returns 503 service unavailable HTTP code.")
.setSince("3.6")
.setChangelog(
+ new Change("10.2", format("Parameter '%s' renamed to '%s'", PARAM_COMPONENT_KEYS, PARAM_COMPONENTS)),
new Change("10.1", "Add the 'codeVariants' parameter, facet and response field"),
new Change("10.0", "Parameter 'sansTop25' is deprecated"),
new Change("10.0", "The value 'sansTop25' for the parameter 'facets' has been deprecated"),
.setBooleanPossibleValues()
.setDefaultValue("false");
- action.createParam(PARAM_COMPONENT_KEYS)
+ action.createParam(PARAM_COMPONENTS)
+ .setDeprecatedKey(PARAM_COMPONENT_KEYS, "10.2")
.setDescription("Comma-separated list of component keys. Retrieve issues associated to a specific list of components (and all its descendants). " +
"A component can be a portfolio, project, module, directory or file.")
.setExampleValue(KEY_PROJECT_EXAMPLE_001);
.setAssigned(request.paramAsBoolean(PARAM_ASSIGNED))
.setAssigneesUuid(getLogins(dbSession, request.paramAsStrings(PARAM_ASSIGNEES)))
.setAuthors(request.multiParam(PARAM_AUTHOR))
- .setComponentKeys(request.paramAsStrings(PARAM_COMPONENT_KEYS))
+ .setComponentKeys(request.paramAsStrings(PARAM_COMPONENTS))
.setCreatedAfter(request.param(PARAM_CREATED_AFTER))
.setCreatedAt(request.param(PARAM_CREATED_AT))
.setCreatedBefore(request.param(PARAM_CREATED_BEFORE))
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_PROJECTS = "projects";
.setParam("assignees", request.getAssignees() == null ? null : request.getAssignees().stream().collect(Collectors.joining(",")))
.setParam("author", request.getAuthor())
.setParam("branch", request.getBranch())
- .setParam("componentKeys", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(",")))
+ .setParam("components", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(",")))
.setParam("createdAfter", request.getCreatedAfter())
.setParam("createdAt", request.getCreatedAt())
.setParam("createdBefore", request.getCreatedBefore())