private Boolean assigned;
private List<String> assigneesUuid;
private List<String> authors;
- private List<String> componentKeys;
- private List<String> componentRootUuids;
- private List<String> componentRoots;
private List<String> componentUuids;
private List<String> components;
private String createdAfter;
private String organization;
private int page;
private int pageSize;
- private List<String> projectKeys;
private List<String> projects;
private List<String> resolutions;
private Boolean resolved;
return this;
}
- @CheckForNull
- public List<String> getComponentKeys() {
- return componentKeys;
- }
-
- public SearchRequest setComponentKeys(@Nullable List<String> componentKeys) {
- this.componentKeys = componentKeys;
- return this;
- }
-
@CheckForNull
public List<String> getComponentUuids() {
return componentUuids;
return this;
}
- @CheckForNull
- public List<String> getProjectKeys() {
- return projectKeys;
- }
-
- public SearchRequest setProjectKeys(@Nullable List<String> projectKeys) {
- this.projectKeys = projectKeys;
- return this;
- }
-
@CheckForNull
public List<String> getResolutions() {
return resolutions;
return this;
}
- @CheckForNull
- public List<String> getComponentRootUuids() {
- return componentRootUuids;
- }
-
- public SearchRequest setComponentRootUuids(@Nullable List<String> componentRootUuids) {
- this.componentRootUuids = componentRootUuids;
- return this;
- }
-
- @CheckForNull
- public List<String> getComponentRoots() {
- return componentRoots;
- }
-
- public SearchRequest setComponentRoots(@Nullable List<String> componentRoots) {
- this.componentRoots = componentRoots;
- return this;
- }
-
@CheckForNull
public List<String> getComponents() {
return components;
package org.sonar.server.issue.index;
import com.google.common.collect.Sets;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
-import org.sonar.db.project.ProjectDto;
import org.sonar.server.es.EsIndexSyncInProgressException;
public class IssueIndexSyncProgressChecker {
/**
* Checks if project issue index sync is in progress, if it is, method throws exception org.sonar.server.es.EsIndexSyncInProgressException
*/
- public void checkIfProjectIssueSyncInProgress(DbSession dbSession, ProjectDto projectDto) throws EsIndexSyncInProgressException {
- if (doProjectNeedIssueSync(dbSession, projectDto.getUuid())) {
+ public void checkIfProjectIssueSyncInProgress(DbSession dbSession, String projectUuid) throws EsIndexSyncInProgressException {
+ if (doProjectNeedIssueSync(dbSession, projectUuid)) {
+ throw new EsIndexSyncInProgressException(IssueIndexDefinition.TYPE_ISSUE.getMainType());
+ }
+ }
+
+ public void checkIfAnyProjectIssueSyncInProgress(DbSession dbSession, Collection<String> projectUuids) throws EsIndexSyncInProgressException {
+ if (!findProjectUuidsWithIssuesSyncNeed(dbSession, projectUuids).isEmpty()) {
throw new EsIndexSyncInProgressException(IssueIndexDefinition.TYPE_ISSUE.getMainType());
}
}
return !findProjectUuidsWithIssuesSyncNeed(dbSession, Sets.newHashSet(projectUuid)).isEmpty();
}
- public List<String> findProjectUuidsWithIssuesSyncNeed(DbSession dbSession, Set<String> projectUuids) {
+ public List<String> findProjectUuidsWithIssuesSyncNeed(DbSession dbSession, Collection<String> projectUuids) {
return dbClient.branchDao().selectProjectUuidsWithIssuesNeedSync(dbSession, projectUuids);
}
}
Boolean onComponentOnly = request.getOnComponentOnly();
Collection<String> components = request.getComponents();
Collection<String> componentUuids = request.getComponentUuids();
- Collection<String> componentKeys = request.getComponentKeys();
- Collection<String> componentRootUuids = request.getComponentRootUuids();
- Collection<String> componentRoots = request.getComponentRoots();
String branch = request.getBranch();
String pullRequest = request.getPullRequest();
boolean effectiveOnComponentOnly = false;
- checkArgument(atMostOneNonNullElement(components, componentUuids, componentKeys, componentRootUuids, componentRoots),
+ checkArgument(atMostOneNonNullElement(components, componentUuids),
"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));
- } else if (componentRoots != null) {
- allComponents.addAll(getComponentsFromKeys(session, componentRoots, branch, pullRequest));
- } else if (components != null) {
+ if (components != null) {
allComponents.addAll(getComponentsFromKeys(session, components, branch, pullRequest));
- effectiveOnComponentOnly = true;
+ effectiveOnComponentOnly = BooleanUtils.isTrue(onComponentOnly);
} else if (componentUuids != null) {
allComponents.addAll(getComponentsFromUuids(session, componentUuids));
effectiveOnComponentOnly = BooleanUtils.isTrue(onComponentOnly);
- } else if (componentKeys != null) {
- allComponents.addAll(getComponentsFromKeys(session, componentKeys, branch, pullRequest));
- effectiveOnComponentOnly = BooleanUtils.isTrue(onComponentOnly);
}
return effectiveOnComponentOnly;
return;
}
- List<String> projectKeys = request.getProjectKeys();
+ List<String> projectKeys = request.getProjects();
if (projectKeys != null) {
List<ComponentDto> projects = getComponentsFromKeys(session, projectKeys, request.getBranch(), request.getPullRequest());
builder.projectUuids(projects.stream().map(IssueQueryFactory::toProjectUuid).collect(toList()));
}
private void addProjectUuidsForApplication(IssueQuery.Builder builder, DbSession session, SearchRequest request) {
- List<String> projectKeys = request.getProjectKeys();
+ List<String> projectKeys = request.getProjects();
if (projectKeys != null) {
// On application, branch should only be applied on the application, not on projects
List<ComponentDto> projects = getComponentsFromKeys(session, projectKeys, null, null);
.setStatuses(asList("CLOSED"))
.setResolutions(asList("FALSE-POSITIVE"))
.setResolved(true)
- .setProjectKeys(asList(project.getDbKey()))
+ .setProjects(asList(project.getDbKey()))
.setModuleUuids(asList(module.uuid()))
.setDirectories(asList("aDirPath"))
.setFileUuids(asList(file.uuid()))
@Test
public void add_unknown_when_no_component_found() {
SearchRequest request = new SearchRequest()
- .setComponentKeys(asList("does_not_exist"));
+ .setComponents(asList("does_not_exist"));
IssueQuery query = underTest.create(request);
@Test
public void fail_if_components_and_components_uuid_params_are_set_at_the_same_time() {
SearchRequest request = new SearchRequest()
- .setComponentKeys(singletonList("foo"))
+ .setComponents(singletonList("foo"))
.setComponentUuids(singletonList("bar"));
expectedException.expect(IllegalArgumentException.class);
}
@Test
- public void fail_if_both_componentRoots_and_componentRootUuids_params_are_set() {
- SearchRequest request = new SearchRequest()
- .setComponentRoots(singletonList("foo"))
- .setComponentRootUuids(singletonList("bar"));
-
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys and componentUuids");
-
- underTest.create(request);
- }
-
- @Test
- public void fail_if_componentRoots_references_components_with_different_qualifier() {
- ComponentDto project = db.components().insertPrivateProject();
- ComponentDto file = db.components().insertComponent(newFileDto(project));
- SearchRequest request = new SearchRequest()
- .setComponentRoots(asList(project.getDbKey(), file.getDbKey()));
-
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("All components must have the same qualifier, found FIL,TRK");
-
- underTest.create(request);
- }
-
- @Test
- public void param_componentRootUuids_enables_search_in_view_tree_if_user_has_permission_on_view() {
+ public void param_componentUuids_enables_search_in_view_tree_if_user_has_permission_on_view() {
ComponentDto view = db.components().insertView();
SearchRequest request = new SearchRequest()
- .setComponentRootUuids(asList(view.uuid()));
+ .setComponentUuids(asList(view.uuid()));
userSession.registerComponents(view);
IssueQuery query = underTest.create(request);
ComponentDto view = db.components().insertView();
ComponentDto subView = db.components().insertComponent(newSubView(view));
SearchRequest request = new SearchRequest()
- .setComponentRootUuids(asList(subView.uuid()));
+ .setComponentUuids(asList(subView.uuid()));
IssueQuery query = underTest.create(request);
public void onComponentOnly_restricts_search_to_specified_componentKeys() {
ComponentDto project = db.components().insertPrivateProject();
SearchRequest request = new SearchRequest()
- .setComponentKeys(asList(project.getDbKey()))
+ .setComponents(asList(project.getDbKey()))
.setOnComponentOnly(true);
IssueQuery query = underTest.create(request);
ComponentDto branch = db.components().insertProjectBranch(project);
assertThat(underTest.create(new SearchRequest()
- .setProjectKeys(singletonList(branch.getKey()))
+ .setProjects(singletonList(branch.getKey()))
.setBranch(branch.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(project.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(project.uuid()), false);
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(branch.getKey()))
+ .setComponents(singletonList(branch.getKey()))
.setBranch(branch.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(project.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(project.uuid()), false);
}
@Test
ComponentDto file = db.components().insertComponent(newFileDto(branch));
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(file.getKey()))
+ .setComponents(singletonList(file.getKey()))
.setBranch(branch.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(branch.getKey()))
+ .setComponents(singletonList(branch.getKey()))
.setFileUuids(singletonList(file.uuid()))
.setBranch(branch.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
assertThat(underTest.create(new SearchRequest()
- .setProjectKeys(singletonList(branch.getKey()))
+ .setProjects(singletonList(branch.getKey()))
.setFileUuids(singletonList(file.uuid()))
.setBranch(branch.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.fileUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
}
@Test
ComponentDto file = db.components().insertComponent(newFileDto(branch));
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(file.getKey()))
+ .setComponents(singletonList(file.getKey()))
.setBranch(branch.getBranch())
.setOnComponentOnly(true)))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.componentUuids()), IssueQuery::isMainBranch)
- .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.componentUuids()), IssueQuery::isMainBranch)
+ .containsOnly(branch.uuid(), singletonList(file.uuid()), false);
}
@Test
ComponentDto branch = db.components().insertProjectBranch(project);
assertThat(underTest.create(new SearchRequest()
- .setProjectKeys(singletonList(project.getKey()))
+ .setProjects(singletonList(project.getKey()))
.setBranch("master")))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(project.uuid(), singletonList(project.uuid()), true);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(project.uuid(), singletonList(project.uuid()), true);
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(project.getKey()))
+ .setComponents(singletonList(project.getKey()))
.setBranch("master")))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(project.uuid(), singletonList(project.uuid()), true);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(project.uuid(), singletonList(project.uuid()), true);
}
@Test
userSession.addProjectPermission(USER, application);
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(application.getKey())))
+ .setComponents(singletonList(application.getKey())))
.viewUuids()).containsExactly(application.uuid());
}
// Search on applicationBranch1
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(applicationBranch1.getKey()))
+ .setComponents(singletonList(applicationBranch1.getKey()))
.setBranch(applicationBranch1.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(applicationBranch1.uuid(), Collections.emptyList(), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(applicationBranch1.uuid(), Collections.emptyList(), false);
// Search on project1Branch1
assertThat(underTest.create(new SearchRequest()
- .setComponentKeys(singletonList(applicationBranch1.getKey()))
- .setProjectKeys(singletonList(project1.getKey()))
+ .setComponents(singletonList(applicationBranch1.getKey()))
+ .setProjects(singletonList(project1.getKey()))
.setBranch(applicationBranch1.getBranch())))
- .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
- .containsOnly(applicationBranch1.uuid(), singletonList(project1.uuid()), false);
+ .extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch)
+ .containsOnly(applicationBranch1.uuid(), singletonList(project1.uuid()), false);
}
@Test
underTest.create(new SearchRequest()
.setSinceLeakPeriod(true)
- .setComponentKeys(asList(project1.getKey(), project2.getKey())));
+ .setComponents(asList(project1.getKey(), project2.getKey())));
}
@Test
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_COMPONENT_KEYS;
-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_CREATED_BEFORE;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ORGANIZATION;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_OWASP_TOP_10;
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_RESOLUTIONS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLVED;
private final System2 system2;
private final DbClient dbClient;
- public SearchAction(UserSession userSession, IssueIndex issueIndex, IssueQueryFactory issueQueryFactory, SearchResponseLoader searchResponseLoader,
- SearchResponseFormat searchResponseFormat, System2 system2, DbClient dbClient) {
+ public SearchAction(UserSession userSession, IssueIndex issueIndex, IssueQueryFactory issueQueryFactory,
+ SearchResponseLoader searchResponseLoader, SearchResponseFormat searchResponseFormat, System2 system2, DbClient dbClient) {
this.userSession = userSession;
this.issueIndex = issueIndex;
this.issueQueryFactory = issueQueryFactory;
WebService.NewAction action = controller
.createAction(ACTION_SEARCH)
.setHandler(this)
- .setDescription(
- "Search for issues.<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)
+ .setDescription("Search for issues.<br>Requires the 'Browse' permission on the specified project(s).")
.setSince("3.6")
.setChangelog(
+ new Change("8.4", "parameters 'componentUuids', 'projectKeys' has been dropped."),
new Change("8.2", "'REVIEWED', 'TO_REVIEW' status param values are no longer supported"),
new Change("8.2", "Security hotspots are no longer returned as type 'SECURITY_HOTSPOT' is not supported anymore, use dedicated api/hotspots"),
new Change("8.2", "response field 'fromHotspot' has been deprecated and is no more populated"),
"A component can be a portfolio, project, module, directory or file.")
.setExampleValue(KEY_PROJECT_EXAMPLE_001);
- 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 +
- "A component can be a project, module, directory or file.")
- .setDeprecatedSince("6.5")
- .setExampleValue("584a89f2-8037-4f7b-b82c-8b45d2d63fb2");
-
action.createParam(PARAM_PROJECTS)
.setDescription("To retrieve issues associated to a specific list of projects (comma-separated list of project keys). " +
INTERNAL_PARAMETER_DISCLAIMER +
"If this parameter is set, projectUuids must not be set.")
- .setDeprecatedKey(PARAM_PROJECT_KEYS, "6.5")
.setInternal(true)
.setExampleValue(KEY_PROJECT_EXAMPLE_001);
addMandatoryValuesToFacet(facets, FACET_PROJECTS, query.projectUuids());
addMandatoryValuesToFacet(facets, PARAM_MODULE_UUIDS, query.moduleUuids());
addMandatoryValuesToFacet(facets, PARAM_FILE_UUIDS, query.fileUuids());
- addMandatoryValuesToFacet(facets, PARAM_COMPONENT_UUIDS, request.getComponentUuids());
List<String> assignees = Lists.newArrayList("");
List<String> assigneesFromRequest = request.getAssigneeUuids();
collector.addProjectUuids(facets.getBucketKeys(FACET_PROJECTS));
collector.addComponentUuids(facets.getBucketKeys(PARAM_MODULE_UUIDS));
collector.addComponentUuids(facets.getBucketKeys(PARAM_FILE_UUIDS));
- collector.addComponentUuids(facets.getBucketKeys(PARAM_COMPONENT_UUIDS));
collector.addRuleIds(facets.getBucketKeys(PARAM_RULES));
collector.addUserUuids(facets.getBucketKeys(PARAM_ASSIGNEES));
}
private static void collectRequestParams(SearchResponseLoader.Collector collector, SearchRequest request) {
collector.addComponentUuids(request.getFileUuids());
collector.addComponentUuids(request.getModuleUuids());
- collector.addComponentUuids(request.getComponentRootUuids());
collector.addUserUuids(request.getAssigneeUuids());
}
.setAssigned(request.paramAsBoolean(PARAM_ASSIGNED))
.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))
- .setComponentUuids(request.paramAsStrings(PARAM_COMPONENT_UUIDS))
+ .setComponents(request.paramAsStrings(PARAM_COMPONENT_KEYS))
.setCreatedAfter(request.param(PARAM_CREATED_AFTER))
.setCreatedAt(request.param(PARAM_CREATED_AT))
.setCreatedBefore(request.param(PARAM_CREATED_BEFORE))
.setOrganization(request.param(PARAM_ORGANIZATION))
.setPage(request.mandatoryParamAsInt(Param.PAGE))
.setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE))
- .setProjectKeys(request.paramAsStrings(PARAM_PROJECTS))
.setProjects(request.paramAsStrings(PARAM_PROJECTS))
.setResolutions(request.paramAsStrings(PARAM_RESOLUTIONS))
.setResolved(request.paramAsBoolean(PARAM_RESOLVED))
import static org.sonar.db.component.ComponentTesting.newView;
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_COMPONENT_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DIRECTORIES;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_FILE_UUIDS;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_MODULE_UUIDS;
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_SINCE_LEAK_PERIOD;
assertThat(ws.newRequest()
.setParam(PARAM_COMPONENT_KEYS, module1.getKey())
.executeProtobuf(SearchWsResponse.class).getIssuesList()).extracting(Issue::getKey)
- .containsExactlyInAnyOrder(issue1.getKey());
+ .containsExactlyInAnyOrder(issue1.getKey());
assertThat(ws.newRequest()
.setParam(PARAM_MODULE_UUIDS, module1.uuid())
.executeProtobuf(SearchWsResponse.class).getIssuesList()).extracting(Issue::getKey)
- .containsExactlyInAnyOrder(issue1.getKey());
+ .containsExactlyInAnyOrder(issue1.getKey());
}
@Test
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENT_UUIDS, project.uuid())
+ .setParam(PARAM_COMPONENT_KEYS, project.getDbKey())
.setParam(PARAM_SINCE_LEAK_PERIOD, "true")
.execute()
.assertJson(this.getClass(), "search_since_leak_period.json");
indexIssues();
ws.newRequest()
- .setParam(PARAM_COMPONENT_UUIDS, project.uuid())
+ .setParam(PARAM_COMPONENT_KEYS, project.getDbKey())
.setParam(PARAM_FILE_UUIDS, file.uuid())
.setParam(PARAM_SINCE_LEAK_PERIOD, "true")
.execute()
.setParam(PARAM_FILE_UUIDS, "unknown")
.execute()
.assertJson(this.getClass(), "no_issue.json");
-
- ws.newRequest()
- .setParam(PARAM_COMPONENT_UUIDS, file.uuid())
- .execute()
- .assertJson(this.getClass(), "search_by_file_uuid.json");
-
- ws.newRequest()
- .setParam(PARAM_COMPONENT_UUIDS, "unknown")
- .execute()
- .assertJson(this.getClass(), "no_issue.json");
}
@Test
.setParam(PARAM_COMPONENT_KEYS, applicationBranch1.getKey())
.setParam(PARAM_BRANCH, applicationBranch1.getBranch())
.executeProtobuf(SearchWsResponse.class).getIssuesList())
- .extracting(Issue::getKey, Issue::getComponent, Issue::getProject, Issue::getBranch, Issue::hasBranch)
- .containsExactlyInAnyOrder(
- tuple(issueOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch(), true),
- tuple(issueOnFileOnProject1Branch1.getKey(), fileOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch(), true),
- tuple(issueOnProject2.getKey(), project2.getKey(), project2.getKey(), "", false));
+ .extracting(Issue::getKey, Issue::getComponent, Issue::getProject, Issue::getBranch, Issue::hasBranch)
+ .containsExactlyInAnyOrder(
+ tuple(issueOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch(), true),
+ tuple(issueOnFileOnProject1Branch1.getKey(), fileOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch(), true),
+ tuple(issueOnProject2.getKey(), project2.getKey(), project2.getKey(), "", false));
// Issues on project1Branch1
assertThat(ws.newRequest()
.setParam(PARAM_PROJECTS, project1.getKey())
.setParam(PARAM_BRANCH, applicationBranch1.getBranch())
.executeProtobuf(SearchWsResponse.class).getIssuesList())
- .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
- .containsExactlyInAnyOrder(
- tuple(issueOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch()),
- tuple(issueOnFileOnProject1Branch1.getKey(), fileOnProject1Branch1.getKey(), project1Branch1.getBranch()));
+ .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
+ .containsExactlyInAnyOrder(
+ tuple(issueOnProject1Branch1.getKey(), project1Branch1.getKey(), project1Branch1.getBranch()),
+ tuple(issueOnFileOnProject1Branch1.getKey(), fileOnProject1Branch1.getKey(), project1Branch1.getBranch()));
}
@Test
SearchWsResponse result = ws.newRequest()
.setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
- .setParam(PARAM_PROJECT_KEYS, project1.getDbKey())
+ .setParam(PARAM_PROJECTS, project1.getDbKey())
.executeProtobuf(SearchWsResponse.class);
assertThat(result.getIssuesList()).extracting(Issue::getKey)
SearchWsResponse result = ws.newRequest()
.setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
- .setParam(PARAM_PROJECT_KEYS, project1.getDbKey())
+ .setParam(PARAM_PROJECTS, project1.getDbKey())
.setParam(PARAM_SINCE_LEAK_PERIOD, "true")
.executeProtobuf(SearchWsResponse.class);
.setParam(PARAM_COMPONENT_KEYS, project.getKey())
.setParam(PARAM_BRANCH, branch.getBranch())
.executeProtobuf(SearchWsResponse.class).getIssuesList())
- .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
- .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
+ .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
+ .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
// On project key + branch
assertThat(ws.newRequest()
- .setParam(PARAM_PROJECT_KEYS, project.getKey())
+ .setParam(PARAM_PROJECTS, project.getKey())
.setParam(PARAM_BRANCH, branch.getBranch())
.executeProtobuf(SearchWsResponse.class).getIssuesList())
- .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
- .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
+ .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
+ .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
// On file key + branch
assertThat(ws.newRequest()
.setParam(PARAM_COMPONENT_KEYS, branchFile.getKey())
.setParam(PARAM_BRANCH, branch.getBranch())
.executeProtobuf(SearchWsResponse.class).getIssuesList())
- .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
- .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
+ .extracting(Issue::getKey, Issue::getComponent, Issue::getBranch)
+ .containsExactlyInAnyOrder(tuple(branchIssue.getKey(), branchFile.getKey(), branchFile.getBranch()));
}
@Test
assertThat(def.responseExampleAsString()).isNotEmpty();
assertThat(def.params()).extracting("key").containsExactlyInAnyOrder(
- "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "componentUuids", "branch",
+ "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "branch",
"pullRequest", "organization",
"createdAfter", "createdAt", "createdBefore", "createdInLast", "directories", "facetMode", "facets", "fileUuids", "issues", "languages", "moduleUuids", "onComponentOnly",
"p", "projects", "ps", "resolutions", "resolved", "rules", "s", "severities", "sinceLeakPeriod",
public static final String PARAM_ASSIGNEE = "assignee";
public static final String PARAM_TRANSITION = "transition";
public static final String PARAM_SEVERITY = "severity";
+ public static final String PARAM_COMPONENT = "component";
public static final String PARAM_COMPONENT_UUID = "componentUuid";
public static final String PARAM_TYPE = "type";
public static final String PARAM_ISSUES = "issues";
public static final String PARAM_COMPONENT_UUIDS = "componentUuids";
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_DIRECTORIES = "directories";
public static final String PARAM_FILE_UUIDS = "fileUuids";
public static final String PARAM_ON_COMPONENT_ONLY = "onComponentOnly";