diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2021-08-26 16:24:36 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-08-26 20:04:29 +0000 |
commit | 680aed78d5a58249ae56ca36b5f495bb579bce1a (patch) | |
tree | f0e4b70fdbf7019d8c1e50c0910f6403d60444ae /server/sonar-webserver-es | |
parent | 5e216710672e237ce18e43c0c8fe82faacaacd3b (diff) | |
download | sonarqube-680aed78d5a58249ae56ca36b5f495bb579bce1a.tar.gz sonarqube-680aed78d5a58249ae56ca36b5f495bb579bce1a.zip |
SONAR-15313 drop endpoints from WebAPI deprecated since 7.X
Co-authored-by: Lukasz Jarocki <lukasz.jarocki@sonarsource.com>
Co-authored-by: Philippe Perrin <philippe.perrin@sonarsource.com>
Co-authored-by: MikeBirnstiehl <michael.birnstiehl@sonarsource.com>
Diffstat (limited to 'server/sonar-webserver-es')
6 files changed, 8 insertions, 30 deletions
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java index 295c252659b..48082da3e9d 100644 --- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java +++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java @@ -115,7 +115,6 @@ import static org.sonar.server.es.searchrequest.TopAggregationHelper.NO_OTHER_SU import static org.sonar.server.issue.index.IssueIndex.Facet.ASSIGNED_TO_ME; import static org.sonar.server.issue.index.IssueIndex.Facet.ASSIGNEES; import static org.sonar.server.issue.index.IssueIndex.Facet.AUTHOR; -import static org.sonar.server.issue.index.IssueIndex.Facet.AUTHORS; import static org.sonar.server.issue.index.IssueIndex.Facet.CREATED_AT; import static org.sonar.server.issue.index.IssueIndex.Facet.CWE; import static org.sonar.server.issue.index.IssueIndex.Facet.DIRECTORIES; @@ -171,7 +170,6 @@ import static org.sonar.server.security.SecurityStandards.SANS_TOP_25_INSECURE_I import static org.sonar.server.security.SecurityStandards.SANS_TOP_25_POROUS_DEFENSES; import static org.sonar.server.security.SecurityStandards.SANS_TOP_25_RISKY_RESOURCE; import static org.sonar.server.view.index.ViewIndexDefinition.TYPE_VIEW; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.DEPRECATED_PARAM_AUTHORS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE_EFFORT; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEES; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_AUTHOR; @@ -180,7 +178,6 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CWE; 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_LANGUAGES; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_MODULE_UUIDS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_OWASP_TOP_10; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLUTIONS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RULES; @@ -200,6 +197,7 @@ public class IssueIndex { public static final String FACET_PROJECTS = "projects"; public static final String FACET_ASSIGNED_TO_ME = "assigned_to_me"; + public static final String FACET_MODULES = "moduleUuids"; private static final int DEFAULT_FACET_SIZE = 15; private static final int MAX_FACET_SIZE = 100; @@ -238,10 +236,9 @@ public class IssueIndex { LANGUAGES(PARAM_LANGUAGES, FIELD_ISSUE_LANGUAGE, STICKY, MAX_FACET_SIZE), RULES(PARAM_RULES, FIELD_ISSUE_RULE_UUID, STICKY, MAX_FACET_SIZE), TAGS(PARAM_TAGS, FIELD_ISSUE_TAGS, STICKY, MAX_FACET_SIZE), - AUTHORS(DEPRECATED_PARAM_AUTHORS, FIELD_ISSUE_AUTHOR_LOGIN, STICKY, MAX_FACET_SIZE), AUTHOR(PARAM_AUTHOR, FIELD_ISSUE_AUTHOR_LOGIN, STICKY, MAX_FACET_SIZE), PROJECT_UUIDS(FACET_PROJECTS, FIELD_ISSUE_PROJECT_UUID, STICKY, MAX_FACET_SIZE), - MODULE_UUIDS(PARAM_MODULE_UUIDS, FIELD_ISSUE_MODULE_UUID, STICKY, MAX_FACET_SIZE), + MODULE_UUIDS(FACET_MODULES, FIELD_ISSUE_MODULE_UUID, STICKY, MAX_FACET_SIZE), FILES(PARAM_FILES, FIELD_ISSUE_FILE_PATH, STICKY, MAX_FACET_SIZE), DIRECTORIES(PARAM_DIRECTORIES, FIELD_ISSUE_DIRECTORY_PATH, STICKY, MAX_FACET_SIZE), ASSIGNEES(PARAM_ASSIGNEES, FIELD_ISSUE_ASSIGNEE_UUID, STICKY, MAX_FACET_SIZE), @@ -674,7 +671,6 @@ public class IssueIndex { addFacetIfNeeded(options, aggregationHelper, esRequest, SCOPES, query.scopes().toArray()); addFacetIfNeeded(options, aggregationHelper, esRequest, LANGUAGES, query.languages().toArray()); addFacetIfNeeded(options, aggregationHelper, esRequest, RULES, query.ruleUuids().toArray()); - addFacetIfNeeded(options, aggregationHelper, esRequest, AUTHORS, query.authors().toArray()); addFacetIfNeeded(options, aggregationHelper, esRequest, AUTHOR, query.authors().toArray()); addFacetIfNeeded(options, aggregationHelper, esRequest, TAGS, query.tags().toArray()); addFacetIfNeeded(options, aggregationHelper, esRequest, TYPES, query.types().toArray()); diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java index cc4c5afef48..c41b8a9f8cd 100644 --- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java +++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java @@ -246,7 +246,6 @@ public class IssueQueryFactory { builder.projectUuids(projects.stream().map(IssueQueryFactory::toProjectUuid).collect(toList())); setBranch(builder, projects.get(0), request.getBranch(), request.getPullRequest()); } - builder.moduleUuids(request.getModuleUuids()); builder.directories(request.getDirectories()); builder.files(request.getFiles()); diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java index e14a0d9f716..fd53c66e579 100644 --- a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java +++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java @@ -201,7 +201,7 @@ public class IssueIndexDebtTest { } @Test - public void facets_on_authors() { + public void facets_on_author() { ComponentDto project = ComponentTesting.newPrivateProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project, null); @@ -211,9 +211,9 @@ public class IssueIndexDebtTest { IssueDocTesting.newDoc("I3", file).setAuthorLogin("simon").setEffort(10L), IssueDocTesting.newDoc("I4", file).setAuthorLogin(null).setEffort(10L)); - Facets facets = new Facets(underTest.search(newQueryBuilder().build(), new SearchOptions().addFacets(singletonList("authors"))), system2.getDefaultTimeZone().toZoneId()); - assertThat(facets.getNames()).containsOnly("authors", FACET_MODE_EFFORT); - assertThat(facets.get("authors")).containsOnly(entry("steph", 10L), entry("simon", 20L)); + Facets facets = new Facets(underTest.search(newQueryBuilder().build(), new SearchOptions().addFacets(singletonList("author"))), system2.getDefaultTimeZone().toZoneId()); + assertThat(facets.getNames()).containsOnly("author", FACET_MODE_EFFORT); + assertThat(facets.get("author")).containsOnly(entry("steph", 10L), entry("simon", 20L)); assertThat(facets.get(FACET_MODE_EFFORT)).containsOnly(entry("total", 40L)); } diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexFacetsTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexFacetsTest.java index ffd2c6b74be..cb779d27eca 100644 --- a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexFacetsTest.java +++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexFacetsTest.java @@ -401,20 +401,6 @@ public class IssueIndexFacetsTest { } @Test - public void facets_on_deprecated_authors() { - ComponentDto project = newPrivateProjectDto(); - ComponentDto file = newFileDto(project, null); - - indexIssues( - newDoc("I1", file).setAuthorLogin("steph"), - newDoc("I2", file).setAuthorLogin("marcel"), - newDoc("I3", file).setAuthorLogin("marcel"), - newDoc("I4", file).setAuthorLogin(null)); - - assertThatFacetHasOnly(IssueQuery.builder(), "authors", entry("steph", 1L), entry("marcel", 2L)); - } - - @Test public void facets_on_authors_return_100_entries_plus_selected_values() { ComponentDto project = newPrivateProjectDto(); indexIssues(rangeClosed(1, 110).mapToObj(i -> newDoc(newFileDto(project, null)).setAuthorLogin("a" + i)).toArray(IssueDoc[]::new)); @@ -422,8 +408,8 @@ public class IssueIndexFacetsTest { IssueDoc issue2 = newDoc(newFileDto(project, null)).setAuthorLogin("user2"); indexIssues(issue1, issue2); - assertThatFacetHasSize(IssueQuery.builder().build(), "authors", 100); - assertThatFacetHasSize(IssueQuery.builder().authors(asList(issue1.authorLogin(), issue2.authorLogin())).build(), "authors", 102); + assertThatFacetHasSize(IssueQuery.builder().build(), "author", 100); + assertThatFacetHasSize(IssueQuery.builder().authors(asList(issue1.authorLogin(), issue2.authorLogin())).build(), "author", 102); } @Test diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java index 2a6035b897b..97844486643 100644 --- a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java +++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java @@ -91,7 +91,6 @@ public class IssueQueryFactoryTest { .setResolutions(asList("FALSE-POSITIVE")) .setResolved(true) .setProjects(asList(project.getDbKey())) - .setModuleUuids(asList(module.uuid())) .setDirectories(asList("aDirPath")) .setFiles(asList(file.uuid())) .setAssigneesUuid(asList(user.getUuid())) @@ -113,7 +112,6 @@ public class IssueQueryFactoryTest { assertThat(query.resolutions()).containsOnly("FALSE-POSITIVE"); assertThat(query.resolved()).isTrue(); assertThat(query.projectUuids()).containsOnly(project.uuid()); - assertThat(query.moduleUuids()).containsOnly(module.uuid()); assertThat(query.files()).containsOnly(file.uuid()); assertThat(query.assignees()).containsOnly(user.getUuid()); assertThat(query.scopes()).containsOnly("TEST", "MAIN"); diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryTest.java index 35dffee0a86..5f881db0990 100644 --- a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryTest.java +++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueQueryTest.java @@ -30,7 +30,6 @@ import org.sonar.db.rule.RuleDefinitionDto; import org.sonar.server.issue.index.IssueQuery.PeriodStart; import static com.google.common.collect.Lists.newArrayList; -import static org.apache.commons.lang.math.RandomUtils.nextInt; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; |