From c84c9ce7619fc312374583ccd8510024a5b1c75c Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Thu, 30 Nov 2017 11:24:21 +0100 Subject: [PATCH] Deprecate old service classes in WsClient, add replacement methods --- .../sonarqube/qa/util/OrganizationTester.java | 2 +- .../org/sonarqube/qa/util/QProfileTester.java | 2 +- .../org/sonarqube/qa/util/UserTester.java | 10 +- .../sonarqube/ws/client/DefaultWsClient.java | 106 +++++++++++++----- .../org/sonarqube/ws/client/WsClient.java | 58 ++++++++-- .../analysis/AnalysisEsResilienceTest.java | 4 +- .../tests/analysis/FavoriteTest.java | 8 +- .../tests/analysis/FileExclusionsTest.java | 2 +- .../tests/analysis/IssueExclusionsTest.java | 2 +- .../tests/analysis/PermissionTest.java | 2 +- .../sonarqube/tests/analysis/ScannerTest.java | 2 +- .../ExecuteAnalysisPermissionTest.java | 8 +- .../authorization/IssuePermissionTest.java | 6 +- .../authorization/PermissionSearchTest.java | 28 ++--- .../PermissionTemplatePageTest.java | 6 +- .../authorization/PermissionTemplateTest.java | 12 +- .../ProvisioningPermissionTest.java | 8 +- .../QualityProfileAdminPermissionTest.java | 4 +- .../ce/ReportFailureNotificationTest.java | 4 +- .../tests/component/ComponentsWsTest.java | 4 +- .../tests/issue/CommonRulesTest.java | 2 +- .../tests/issue/IssueActionTest.java | 2 +- .../tests/issue/IssueBulkChangeTest.java | 2 +- .../tests/issue/IssueChangelogTest.java | 2 +- .../issue/IssueCreationDateQPChangedTest.java | 2 +- .../issue/IssueFilterOnCommonRulesTest.java | 4 +- .../tests/issue/IssueNotificationsTest.java | 12 +- .../tests/issue/IssueSearchTest.java | 2 +- .../sonarqube/tests/issue/IssueTagsTest.java | 8 +- .../tests/issue/IssueTrackingTest.java | 2 +- .../tests/issue/IssueWorkflowTest.java | 4 +- .../issue/OrganizationIssueAssignTest.java | 6 +- .../org/sonarqube/tests/lite/LiteTest.java | 6 +- .../tests/measure/MeasuresWsTest.java | 6 +- .../tests/measure/TimeMachineTest.java | 4 +- .../tests/organization/BillingTest.java | 4 +- .../OrganizationMembershipTest.java | 8 +- .../tests/organization/OrganizationTest.java | 14 +-- .../PersonalOrganizationTest.java | 2 +- .../performance/scanner/DuplicationTest.java | 2 +- .../project/ProjectBulkDeletionPageTest.java | 2 +- .../tests/project/ProjectDeletionTest.java | 2 +- .../tests/project/ProjectFilterTest.java | 2 +- .../tests/project/ProjectKeyUpdateTest.java | 10 +- .../project/ProjectProvisioningTest.java | 2 +- .../project/ProjectVisibilityPageTest.java | 4 +- .../OrganizationQualityGateUiTest.java | 2 +- .../tests/qualityGate/QualityGateTest.java | 2 +- .../TechnicalDebtInIssueChangelogTest.java | 4 +- .../tests/qualityModel/TechnicalDebtTest.java | 2 +- ...uiltInQualityProfilesNotificationTest.java | 12 +- .../OrganizationQualityProfilesUiTest.java | 4 +- .../QualityProfilesEditTest.java | 2 +- .../qualityProfile/QualityProfilesUiTest.java | 6 +- .../qualityProfile/QualityProfilesWsTest.java | 6 +- .../tests/serverSystem/LogsTest.java | 2 +- .../tests/serverSystem/RestartTest.java | 2 +- .../tests/settings/SettingsTest.java | 6 +- .../sonarqube/tests/upgrade/UpgradeTest.java | 2 +- .../user/OAuth2IdentityProviderTest.java | 2 +- .../OrganizationIdentityProviderTest.java | 2 +- tests/src/test/java/util/ItUtils.java | 10 +- tests/src/test/java/util/issue/IssueRule.java | 2 +- tests/src/test/java/util/user/UserRule.java | 2 +- 64 files changed, 280 insertions(+), 184 deletions(-) diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java index f38dbde22e8..85a9c8da5aa 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java @@ -136,6 +136,6 @@ public class OrganizationTester { } public OrganizationService service() { - return session.wsClient().organizations(); + return session.wsClient().organizationsOld(); } } diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java index 38e81ca6769..c28530f86de 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java @@ -50,7 +50,7 @@ public class QProfileTester { } public QualityProfilesService service() { - return session.wsClient().qualityProfiles(); + return session.wsClient().qualityProfilesOld(); } @SafeVarargs diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java index 9445767c8f1..af434c5d2ac 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java @@ -74,7 +74,7 @@ public class UserTester { @SafeVarargs public final User generateAdministrator(Consumer... populators) { User user = generate(populators); - session.wsClient().permissions().addUser(new org.sonarqube.ws.client.permission.AddUserRequest().setLogin(user.getLogin()).setPermission("admin")); + session.wsClient().permissionsOld().addUser(new org.sonarqube.ws.client.permission.AddUserRequest().setLogin(user.getLogin()).setPermission("admin")); session.wsClient().userGroups().addUser(new AddUserRequest().setLogin(user.getLogin()).setName("sonar-administrators")); return user; } @@ -83,7 +83,7 @@ public class UserTester { public final User generateAdministrator(Organizations.Organization organization, Consumer... populators) { String organizationKey = organization.getKey(); User user = generate(populators); - session.wsClient().organizations().addMember(organizationKey, user.getLogin()); + session.wsClient().organizationsOld().addMember(organizationKey, user.getLogin()); session.wsClient().userGroups().addUser(new AddUserRequest() .setOrganization(organizationKey) .setLogin(user.getLogin()) @@ -94,7 +94,7 @@ public class UserTester { @SafeVarargs public final User generateAdministratorOnDefaultOrganization(Consumer... populators) { User user = generate(populators); - session.wsClient().organizations().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin()); + session.wsClient().organizationsOld().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin()); session.wsClient().userGroups().addUser(new AddUserRequest() .setOrganization(DEFAULT_ORGANIZATION_KEY) .setLogin(user.getLogin()) @@ -105,14 +105,14 @@ public class UserTester { @SafeVarargs public final User generateMember(Organizations.Organization organization, Consumer... populators) { User user = generate(populators); - session.wsClient().organizations().addMember(organization.getKey(), user.getLogin()); + session.wsClient().organizationsOld().addMember(organization.getKey(), user.getLogin()); return user; } @SafeVarargs public final User generateMemberOfDefaultOrganization(Consumer... populators) { User user = generate(populators); - session.wsClient().organizations().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin()); + session.wsClient().organizationsOld().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin()); return user; } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java index 7ae83705d7a..9bf77e9cde0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java @@ -20,19 +20,22 @@ package org.sonarqube.ws.client; import org.sonarqube.ws.client.ce.CeService; -import org.sonarqube.ws.client.component.ComponentsService; +import org.sonarqube.ws.client.components.ComponentsService; import org.sonarqube.ws.client.favorites.FavoritesService; -import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.measure.MeasuresService; +import org.sonarqube.ws.client.issues.IssuesService; +import org.sonarqube.ws.client.measures.MeasuresService; import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organization.OrganizationService; -import org.sonarqube.ws.client.permission.PermissionsService; +import org.sonarqube.ws.client.organizations.OrganizationsService; +import org.sonarqube.ws.client.permissions.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; +import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; +import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; import org.sonarqube.ws.client.roots.RootsService; import org.sonarqube.ws.client.rules.RulesService; import org.sonarqube.ws.client.settings.SettingsService; @@ -51,17 +54,23 @@ import org.sonarqube.ws.client.webhooks.WebhooksService; class DefaultWsClient implements WsClient { private final WsConnector wsConnector; - private final OrganizationService organizations; - private final PermissionsService permissionsService; - private final ComponentsService componentsService; + private final OrganizationService organizationsOld; + private final OrganizationsService organizations; + private final org.sonarqube.ws.client.permission.PermissionsService permissionsOld; + private final PermissionsService permissions; + private final org.sonarqube.ws.client.component.ComponentsService componentsOld; + private final ComponentsService components; private final FavoritesService favoritesService; - private final QualityProfilesService qualityProfilesService; - private final IssuesService issuesService; + private final QualityProfilesService qualityProfilesOld; + private final QualityprofilesService qualityprofiles; + private final org.sonarqube.ws.client.issue.IssuesService issuesOld; + private final IssuesService issues; private final UsersService usersService; private final UserGroupsService userGroupsService; private final UserTokensService userTokensService; private final QualitygatesService qualityGatesService; - private final MeasuresService measuresService; + private final org.sonarqube.ws.client.measure.MeasuresService measuresOld; + private final MeasuresService measures; private final SystemService systemService; private final CeService ceService; private final RulesService rulesService; @@ -70,23 +79,30 @@ class DefaultWsClient implements WsClient { private final SettingsService settingsService; private final RootsService rootsService; private final WebhooksService webhooksService; - private final ProjectAnalysisService projectAnalysisService; + private final ProjectAnalysisService projectAnalysisOld; + private final ProjectAnalysesService projectAnalyses; private final NotificationsService notificationsService; private final ProjectBranchesService projectBranchesService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; - this.organizations = new OrganizationService(wsConnector); - this.permissionsService = new PermissionsService(wsConnector); - this.componentsService = new ComponentsService(wsConnector); + this.organizationsOld = new OrganizationService(wsConnector); + this.organizations = new OrganizationsService(wsConnector); + this.permissionsOld = new org.sonarqube.ws.client.permission.PermissionsService(wsConnector); + this.permissions = new PermissionsService(wsConnector); + this.componentsOld = new org.sonarqube.ws.client.component.ComponentsService(wsConnector); + this.components = new ComponentsService(wsConnector); this.favoritesService = new FavoritesService(wsConnector); - this.qualityProfilesService = new QualityProfilesService(wsConnector); - this.issuesService = new IssuesService(wsConnector); + this.qualityProfilesOld = new QualityProfilesService(wsConnector); + this.qualityprofiles = new QualityprofilesService(wsConnector); + this.issuesOld = new org.sonarqube.ws.client.issue.IssuesService(wsConnector); + this.issues = new IssuesService(wsConnector); this.usersService = new UsersService(wsConnector); this.userGroupsService = new UserGroupsService(wsConnector); this.userTokensService = new UserTokensService(wsConnector); this.qualityGatesService = new QualitygatesService(wsConnector); - this.measuresService = new MeasuresService(wsConnector); + this.measuresOld = new org.sonarqube.ws.client.measure.MeasuresService(wsConnector); + this.measures = new MeasuresService(wsConnector); this.systemService = new SystemService(wsConnector); this.ceService = new CeService(wsConnector); this.rulesService = new RulesService(wsConnector); @@ -95,7 +111,8 @@ class DefaultWsClient implements WsClient { this.settingsService = new SettingsService(wsConnector); this.rootsService = new RootsService(wsConnector); this.webhooksService = new WebhooksService(wsConnector); - this.projectAnalysisService = new ProjectAnalysisService(wsConnector); + this.projectAnalysisOld = new ProjectAnalysisService(wsConnector); + this.projectAnalyses = new ProjectAnalysesService(wsConnector); this.projectBranchesService = new ProjectBranchesService(wsConnector); this.notificationsService = new NotificationsService(wsConnector); } @@ -106,18 +123,33 @@ class DefaultWsClient implements WsClient { } @Override - public OrganizationService organizations() { + public OrganizationService organizationsOld() { + return organizationsOld; + } + + @Override + public OrganizationsService organizations() { return organizations; } + @Override + public org.sonarqube.ws.client.permission.PermissionsService permissionsOld() { + return this.permissionsOld; + } + @Override public PermissionsService permissions() { - return this.permissionsService; + return permissions; + } + + @Override + public org.sonarqube.ws.client.component.ComponentsService componentsOld() { + return componentsOld; } @Override public ComponentsService components() { - return componentsService; + return components; } @Override @@ -126,13 +158,23 @@ class DefaultWsClient implements WsClient { } @Override - public QualityProfilesService qualityProfiles() { - return qualityProfilesService; + public QualityProfilesService qualityProfilesOld() { + return qualityProfilesOld; + } + + @Override + public QualityprofilesService qualityProfiles() { + return qualityprofiles; + } + + @Override + public org.sonarqube.ws.client.issue.IssuesService issuesOld() { + return issuesOld; } @Override public IssuesService issues() { - return issuesService; + return issues; } @Override @@ -155,9 +197,14 @@ class DefaultWsClient implements WsClient { return qualityGatesService; } + @Override + public org.sonarqube.ws.client.measure.MeasuresService measuresOld() { + return measuresOld; + } + @Override public MeasuresService measures() { - return measuresService; + return measures; } @Override @@ -201,8 +248,13 @@ class DefaultWsClient implements WsClient { } @Override - public ProjectAnalysisService projectAnalysis() { - return projectAnalysisService; + public ProjectAnalysisService projectAnalysisOld() { + return projectAnalysisOld; + } + + @Override + public ProjectAnalysesService projectAnalyses() { + return projectAnalyses; } @Override diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java index 96c20272caf..c6d200e935d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java @@ -20,19 +20,22 @@ package org.sonarqube.ws.client; import org.sonarqube.ws.client.ce.CeService; -import org.sonarqube.ws.client.component.ComponentsService; +import org.sonarqube.ws.client.components.ComponentsService; import org.sonarqube.ws.client.favorites.FavoritesService; -import org.sonarqube.ws.client.issue.IssuesService; -import org.sonarqube.ws.client.measure.MeasuresService; +import org.sonarqube.ws.client.issues.IssuesService; +import org.sonarqube.ws.client.measures.MeasuresService; import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organization.OrganizationService; -import org.sonarqube.ws.client.permission.PermissionsService; +import org.sonarqube.ws.client.organizations.OrganizationsService; +import org.sonarqube.ws.client.permissions.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; +import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; +import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; import org.sonarqube.ws.client.roots.RootsService; import org.sonarqube.ws.client.rules.RulesService; import org.sonarqube.ws.client.settings.SettingsService; @@ -61,19 +64,50 @@ import org.sonarqube.ws.client.webhooks.WebhooksService; * @since 5.3 */ public interface WsClient { - OrganizationService organizations(); + + /** + * @deprecated since 7.0 use {@link #organizations()} instead + */ + @Deprecated + OrganizationService organizationsOld(); + + OrganizationsService organizations(); + + /** + * @deprecated since 7.0 use {@link #components()} instead + */ + @Deprecated + org.sonarqube.ws.client.component.ComponentsService componentsOld(); ComponentsService components(); FavoritesService favorites(); + /** + * @deprecated since 7.0 use {@link #issues()} instead + */ + @Deprecated + org.sonarqube.ws.client.issue.IssuesService issuesOld(); + IssuesService issues(); NotificationsService notifications(); + /** + * @deprecated since 7.0 use {@link #permissions()} instead + */ + @Deprecated + org.sonarqube.ws.client.permission.PermissionsService permissionsOld(); + PermissionsService permissions(); - QualityProfilesService qualityProfiles(); + /** + * @deprecated since 7.0 use {@link #qualityProfiles()} instead + */ + @Deprecated + QualityProfilesService qualityProfilesOld(); + + QualityprofilesService qualityProfiles(); UsersService users(); @@ -83,6 +117,12 @@ public interface WsClient { QualitygatesService qualityGates(); + /** + * @deprecated since 7.0 use {@link #measures()} instead + */ + @Deprecated + org.sonarqube.ws.client.measure.MeasuresService measuresOld(); + MeasuresService measures(); SystemService system(); @@ -120,8 +160,12 @@ public interface WsClient { /** * @since 6.3 + * @deprecated since 7.0 use {@link #projectAnalyses()} instead */ - ProjectAnalysisService projectAnalysis(); + @Deprecated + ProjectAnalysisService projectAnalysisOld(); + + ProjectAnalysesService projectAnalyses(); /** * @since 6.6> diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java index a02bb02e8be..46b49e6eb67 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java @@ -229,7 +229,7 @@ public class AnalysisEsResilienceTest { SearchRequest request = new SearchRequest() .setProjectKeys(Collections.singletonList(projectKey)) .setFacets(Collections.singletonList("statuses")); - return tester.wsClient().issues().search(request); + return tester.wsClient().issuesOld().search(request); } private List searchFile(String key, Organization organization) { @@ -237,7 +237,7 @@ public class AnalysisEsResilienceTest { .setS(key) .build(); Map response = ItUtils.jsonToMap( - tester.wsClient().components().suggestions(query).content() + tester.wsClient().componentsOld().suggestions(query).content() ); List results = (List) response.get("results"); Map trkResult = (Map) results.stream().filter(result -> "FIL".equals(((Map) result).get("q"))).findAny().get(); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java index 6d291bca43d..02c80ef8f3b 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java @@ -105,18 +105,18 @@ public class FavoriteTest { } private void addProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissionsOld().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() + adminWsClient.permissionsOld().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) .setPermission("admin") .build()); } private void removeProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissionsOld().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissions().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() + adminWsClient.permissionsOld().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) .setPermission("admin") .build()); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java index 17c6a7357bb..75cffdb3e11 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java @@ -134,6 +134,6 @@ public class FileExclusionsTest { } public static List getComponents(String qualifier) { - return newWsClient(orchestrator).components().tree(new TreeRequest().setBaseComponentKey(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList(); + return newWsClient(orchestrator).componentsOld().tree(new TreeRequest().setBaseComponentKey(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList(); } } diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java index 19dc6faba4c..ad68417e7c4 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java @@ -239,7 +239,7 @@ public class IssueExclusionsTest { tester.projects().provision(p -> p .setKey("com.sonarsource.it.samples:multi-modules-exclusions") .setName("Sonar :: Integration Tests :: Multi-modules With Exclusions")); - tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder().setProjectKey("com.sonarsource.it.samples:multi-modules-exclusions") + tester.wsClient().qualityProfilesOld().addProject(AddProjectRequest.builder().setProjectKey("com.sonarsource.it.samples:multi-modules-exclusions") .setLanguage("xoo").setQualityProfile("with-many-rules").build()); SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR)) diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java index d595e032cad..e567234c60a 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java @@ -147,7 +147,7 @@ public class PermissionTest { } private void addUserPermission(String login, String permission, @Nullable String projectKey) { - adminWsClient.permissions().addUser(new AddUserRequest() + adminWsClient.permissionsOld().addUser(new AddUserRequest() .setLogin(login) .setPermission(permission) .setProjectKey(projectKey)); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java index bdc330eec29..fa7261ced8b 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java @@ -68,7 +68,7 @@ public class ScannerTest { scan("shared/xoo-multi-modules-sample"); scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x"); - assertThat(tester.wsClient().components().search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2); + assertThat(tester.wsClient().componentsOld().search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2); assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample").getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample"); assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample:branch/0.x").getName()) .isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x"); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java index 3f3c0750f75..ad2add0614f 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java @@ -112,7 +112,7 @@ public class ExecuteAnalysisPermissionTest { @Test public void execute_analysis_with_scan_on_default_template() { removeGlobalPermission("anyone", "scan"); - tester.wsClient().permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() + tester.wsClient().permissionsOld().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() .setPermission("scan") .setTemplateId("default_template") .build()); @@ -121,15 +121,15 @@ public class ExecuteAnalysisPermissionTest { } private void addProjectPermission(String groupName, String projectKey, String permission) { - tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); + tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); } private void addGlobalPermission(String groupName, String permission) { - tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName(groupName).setPermission(permission)); } private void removeGlobalPermission(String groupName, String permission) { - tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName(groupName).setPermission(permission)); } private static void executeLoggedAnalysis() { diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java index d3734d24e05..94cccebeba6 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java @@ -256,7 +256,7 @@ public class IssuePermissionTest { } private Issues.BulkChangeWsResponse makeBlockerAndFalsePositive(String user, Issue issueOnPrivateProject, Issue issueOnPublicProject) { - return newUserWsClient(orchestrator, user, "password").issues() + return newUserWsClient(orchestrator, user, "password").issuesOld() .bulkChange(BulkChangeRequest.builder().setIssues(asList(issueOnPrivateProject.key(), issueOnPublicProject.key())) .setSetSeverity("BLOCKER") .setDoTransition("falsepositive") @@ -264,7 +264,7 @@ public class IssuePermissionTest { } private void addUserPermission(String login, String projectKey, String permission) { - tester.wsClient().permissions().addUser( + tester.wsClient().permissionsOld().addUser( new AddUserRequest() .setLogin(login) .setProjectKey(projectKey) @@ -272,6 +272,6 @@ public class IssuePermissionTest { } private static Issues.ChangelogWsResponse changelog(String issueKey, String login, String password) { - return newUserWsClient(orchestrator, login, password).issues().changelog(issueKey); + return newUserWsClient(orchestrator, login, password).issuesOld().changelog(issueKey); } } diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java index 77a24d84976..955605c06dd 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java @@ -78,26 +78,26 @@ public class PermissionSearchTest { @Test public void permission_web_services() { - tester.wsClient().permissions().addUser( + tester.wsClient().permissionsOld().addUser( new AddUserRequest() .setPermission("admin") .setLogin(LOGIN)); - tester.wsClient().permissions().addGroup( + tester.wsClient().permissionsOld().addGroup( new AddGroupRequest() .setPermission("admin") .setGroupName(GROUP_NAME)); - Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions(); + Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissionsOld().searchGlobalPermissions(); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getKey()).isEqualTo("admin"); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getUsersCount()).isEqualTo(1); // by default, a group has the global admin permission assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2); - Permissions.UsersWsResponse users = tester.wsClient().permissions() + Permissions.UsersWsResponse users = tester.wsClient().permissionsOld() .users(new UsersRequest().setPermission("admin")); assertThat(users.getUsersList()).extracting("login").contains(LOGIN); - Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions() + Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissionsOld() .groups(new GroupsRequest() .setPermission("admin")); assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME); @@ -105,31 +105,31 @@ public class PermissionSearchTest { @Test public void template_permission_web_services() { - Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate( + Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissionsOld().createTemplate( new CreateTemplateRequest() .setName("my-new-template") .setDescription("template-used-in-tests")); assertThat(createTemplateWsResponse.getPermissionTemplate().getName()).isEqualTo("my-new-template"); - tester.wsClient().permissions().addUserToTemplate( + tester.wsClient().permissionsOld().addUserToTemplate( new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); - tester.wsClient().permissions().addGroupToTemplate( + tester.wsClient().permissionsOld().addGroupToTemplate( new AddGroupToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); - tester.wsClient().permissions().addProjectCreatorToTemplate( + tester.wsClient().permissionsOld().addProjectCreatorToTemplate( AddProjectCreatorToTemplateRequest.builder() .setPermission("admin") .setTemplateName("my-new-template") .build()); - SearchTemplatesWsResponse searchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( + SearchTemplatesWsResponse searchTemplatesWsResponse = tester.wsClient().permissionsOld().searchTemplates( new SearchTemplatesRequest() .setQuery("my-new-template")); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getName()).isEqualTo("my-new-template"); @@ -138,26 +138,26 @@ public class PermissionSearchTest { assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getGroupsCount()).isEqualTo(1); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getWithProjectCreator()).isTrue(); - tester.wsClient().permissions().removeGroupFromTemplate( + tester.wsClient().permissionsOld().removeGroupFromTemplate( new RemoveGroupFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); - tester.wsClient().permissions().removeUserFromTemplate( + tester.wsClient().permissionsOld().removeUserFromTemplate( new RemoveUserFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); - tester.wsClient().permissions().removeProjectCreatorFromTemplate( + tester.wsClient().permissionsOld().removeProjectCreatorFromTemplate( RemoveProjectCreatorFromTemplateRequest.builder() .setPermission("admin") .setTemplateName("my-new-template") .build() ); - SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( + SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = tester.wsClient().permissionsOld().searchTemplates( new SearchTemplatesRequest() .setQuery("my-new-template")); assertThat(clearedSearchTemplatesWsResponse.getPermissionTemplates(0).getPermissionsList()) diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java index f5149f8c631..d88784cd1be 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java @@ -48,8 +48,8 @@ public class PermissionTemplatePageTest { String userLogin = tester.users().generateMemberOfDefaultOrganization().getLogin(); String adminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin(); - tester.wsClient().permissions().createTemplate(new CreateTemplateRequest().setName("foo-template")); - tester.wsClient().permissions().addUserToTemplate( + tester.wsClient().permissionsOld().createTemplate(new CreateTemplateRequest().setName("foo-template")); + tester.wsClient().permissionsOld().addUserToTemplate( new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("foo-template") @@ -58,7 +58,7 @@ public class PermissionTemplatePageTest { ProjectsManagementPage page = tester.openBrowser().logIn().submitCredentials(adminLogin).openProjectsManagement(); page.shouldHaveProject(project); page.bulkApplyPermissionTemplate("foo-template"); - Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersRequest() + Permissions.UsersWsResponse usersResponse = tester.wsClient().permissionsOld().users(new UsersRequest() .setProjectKey(project) .setPermission("admin") ); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java index 1f20a5b549a..ad7898a3ab7 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java @@ -90,7 +90,7 @@ public class PermissionTemplateTest { CreateWsResponse.User user = tester.users().generateMember(organization); CreateWsResponse.User anotherUser = tester.users().generateMember(organization); Permissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate(); - tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateRequest() + tester.wsClient().permissionsOld().addUserToTemplate(new AddUserToTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setLogin(user.getLogin()) @@ -99,7 +99,7 @@ public class PermissionTemplateTest { Project project2 = createPrivateProject(organization); Project untouchedProject = createPrivateProject(organization); - tester.wsClient().permissions().bulkApplyTemplate(new BulkApplyTemplateRequest() + tester.wsClient().permissionsOld().bulkApplyTemplate(new BulkApplyTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setProjects(Arrays.asList(project1.getKey(), project2.getKey()))); @@ -156,7 +156,7 @@ public class PermissionTemplateTest { */ private void createAndApplyTemplate(Organization organization, Project project, CreateWsResponse.User user) { String templateName = "For user"; - PermissionsService service = tester.wsClient().permissions(); + PermissionsService service = tester.wsClient().permissionsOld(); service.createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(templateName) @@ -173,7 +173,7 @@ public class PermissionTemplateTest { } private CreateTemplateWsResponse createTemplate(Organization organization) { - return tester.wsClient().permissions().createTemplate(new CreateTemplateRequest() + return tester.wsClient().permissionsOld().createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(randomAlphabetic(20))); } @@ -193,7 +193,7 @@ public class PermissionTemplateTest { private boolean userHasAccessToIndexedProject(CreateWsResponse.User user, Organization organization, Project project) { SearchProjectsRequest request = SearchProjectsRequest.builder().setOrganization(organization.getKey()).build(); WsClient userSession = tester.as(user.getLogin()).wsClient(); - return userSession.components().searchProjects(request) + return userSession.componentsOld().searchProjects(request) .getComponentsList().stream() .anyMatch(c -> c.getKey().equals(project.getKey())); } @@ -203,7 +203,7 @@ public class PermissionTemplateTest { .setOrganization(organization.getKey()) .setProjectKey(project.getKey()) .setPermission("user"); - Permissions.UsersWsResponse response = tester.wsClient().permissions().users(request); + Permissions.UsersWsResponse response = tester.wsClient().permissionsOld().users(request); Optional found = response.getUsersList().stream() .filter(u -> user.getLogin().equals(u.getLogin())) .findFirst(); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java index f2dd1d9a704..06c86e2947c 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java @@ -58,7 +58,7 @@ public class ProvisioningPermissionTest { @BeforeClass public static void init() { // remove default permission "provisioning" from anyone(); - tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("provisioning")); tester.users().generate(u -> u.setLogin(ADMIN_WITH_PROVISIONING).setPassword(PASSWORD)); addUserPermission(ADMIN_WITH_PROVISIONING, "admin"); @@ -77,7 +77,7 @@ public class ProvisioningPermissionTest { @AfterClass public static void restoreData() throws Exception { - tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("provisioning")); } /** @@ -130,10 +130,10 @@ public class ProvisioningPermissionTest { } private static void addUserPermission(String login, String permission) { - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission(permission)); } private static void removeUserPermission(String login, String permission) { - tester.wsClient().permissions().removeUser(new RemoveUserRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissionsOld().removeUser(new RemoveUserRequest().setLogin(login).setPermission(permission)); } } diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java index c06e735a031..67dc2382bb9 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java @@ -49,7 +49,7 @@ public class QualityProfileAdminPermissionTest { tester.users().generate(u -> u.setLogin("not_profileadm").setPassword("userpwd")); tester.users().generate(u -> u.setLogin("profileadm").setPassword("papwd")); - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin("profileadm").setPermission("profileadmin")); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin("profileadm").setPermission("profileadmin")); createProfile("xoo", "foo"); Selenese.runSelenese(orchestrator, @@ -60,7 +60,7 @@ public class QualityProfileAdminPermissionTest { } private void createProfile(String language, String name) { - tester.wsClient().qualityProfiles().create(CreateRequest.builder() + tester.wsClient().qualityProfilesOld().create(CreateRequest.builder() .setLanguage(language) .setName(name) .build()); diff --git a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java index ccb74e981ec..1ba534bf60f 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java @@ -109,12 +109,12 @@ public class ReportFailureNotificationTest { Projects.CreateWsResponse.Project project2 = tester.projects().provision(organization, t -> t.setName("Project2")); Projects.CreateWsResponse.Project project3 = tester.projects().provision(organization, t -> t.setName("Project3")); // user 1 is admin of project 1 and will subscribe to global notifications - tester.wsClient().permissions().addUser(new AddUserRequest() + tester.wsClient().permissionsOld().addUser(new AddUserRequest() .setLogin(user1.getLogin()) .setPermission("admin") .setProjectKey(project1.getKey())); // user 2 is admin of project 2 but won't subscribe to global notifications - tester.wsClient().permissions().addUser(new AddUserRequest() + tester.wsClient().permissionsOld().addUser(new AddUserRequest() .setLogin(user2.getLogin()) .setPermission("admin") .setProjectKey(project2.getKey())); diff --git a/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java b/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java index a14c73445df..dbd32671196 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java @@ -53,7 +53,7 @@ public class ComponentsWsTest { @Test public void show() { - Components.ShowWsResponse response = tester.wsClient().components().show(new ShowRequest().setKey(FILE_KEY)); + Components.ShowWsResponse response = tester.wsClient().componentsOld().show(new ShowRequest().setKey(FILE_KEY)); assertThat(response).isNotNull(); assertThat(response.getComponent().getKey()).isEqualTo(FILE_KEY); @@ -62,7 +62,7 @@ public class ComponentsWsTest { @Test public void search() { - Components.SearchWsResponse response = tester.wsClient().components().search(new SearchRequest() + Components.SearchWsResponse response = tester.wsClient().componentsOld().search(new SearchRequest() .setQualifiers(singletonList("FIL"))); assertThat(response).isNotNull(); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java b/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java index e5a8aee0e5f..a18c02e6795 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/CommonRulesTest.java @@ -86,7 +86,7 @@ public class CommonRulesTest extends AbstractIssueTest { } private List findIssues(String componentKey, String ruleKey) { - return adminWsClient.issues().search( + return adminWsClient.issuesOld().search( new SearchRequest() .setComponents(singletonList(componentKey)) .setRules(singletonList(ruleKey))) diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java index dbb4d6eef17..f4a1a4bc3e0 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueActionTest.java @@ -63,7 +63,7 @@ public class IssueActionTest extends AbstractIssueTest { this.projectAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey).withQualityProfile(qualityProfileKey); this.projectAnalysis.run(); - this.issuesService = newAdminWsClient(ORCHESTRATOR).issues(); + this.issuesService = newAdminWsClient(ORCHESTRATOR).issuesOld(); this.randomIssue = issueRule.getRandomIssue(); } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java index 4c4fd88cf2d..ab9fee0b3f6 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueBulkChangeTest.java @@ -69,7 +69,7 @@ public class IssueBulkChangeTest extends AbstractIssueTest { String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample"); this.xooSampleLittleIssuesAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey) .withQualityProfile(qualityProfileKey); - this.issuesService = newAdminWsClient(ORCHESTRATOR).issues(); + this.issuesService = newAdminWsClient(ORCHESTRATOR).issuesOld(); } @Test diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueChangelogTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueChangelogTest.java index d96536d1bd1..cb5a08fd89c 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueChangelogTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueChangelogTest.java @@ -118,7 +118,7 @@ public class IssueChangelogTest extends AbstractIssueTest { } private static Issues.ChangelogWsResponse changelog(String issueKey) { - return adminClient.issues().changelog(issueKey); + return adminClient.issuesOld().changelog(issueKey); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDateQPChangedTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDateQPChangedTest.java index c454ab681da..c50bd459e95 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDateQPChangedTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDateQPChangedTest.java @@ -358,7 +358,7 @@ public class IssueCreationDateQPChangedTest extends AbstractIssueTest { private static Date getAnalysisDate(Function, Optional> chooseItem) { return Optional.of( ItUtils.newWsClient(ORCHESTRATOR) - .projectAnalysis() + .projectAnalysisOld() .search(SearchRequest.builder().setProject(SAMPLE_PROJECT_KEY).build()) .getAnalysesList()) .flatMap(chooseItem) diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java index a7a8708a382..88bc4569dbd 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueFilterOnCommonRulesTest.java @@ -112,7 +112,7 @@ public class IssueFilterOnCommonRulesTest extends AbstractIssueTest { } private List findIssuesByRuleKey(String ruleKey) { - return adminWsClient.issues().search( + return adminWsClient.issuesOld().search( new SearchRequest() .setComponents(singletonList(FILE_KEY)) .setRules(singletonList(ruleKey))) @@ -120,7 +120,7 @@ public class IssueFilterOnCommonRulesTest extends AbstractIssueTest { } private List findAllIssues() { - return adminWsClient.issues().search(new SearchRequest()).getIssuesList(); + return adminWsClient.issuesOld().search(new SearchRequest()).getIssuesList(); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java index 529191d7145..fc38ee73cef 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java @@ -174,9 +174,9 @@ public class IssueNotificationsTest { clearSmtpMessages(); // Change assignee - SearchWsResponse issues = tester.wsClient().issues().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); + SearchWsResponse issues = tester.wsClient().issuesOld().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); Issue issue = issues.getIssuesList().get(0); - tester.wsClient().issues().assign(new AssignRequest(issue.getKey(), userWithUserRole.getLogin())); + tester.wsClient().issuesOld().assign(new AssignRequest(issue.getKey(), userWithUserRole.getLogin())); // Only the assignee should receive the email waitUntilAllNotificationsAreDelivered(1); @@ -245,18 +245,18 @@ public class IssueNotificationsTest { assertThat(smtpServer.getMessages()).hasSize(privateProject ? 2 : 3); clearSmtpMessages(); - SearchWsResponse issues = tester.wsClient().issues().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); + SearchWsResponse issues = tester.wsClient().issuesOld().search(new SearchRequest().setProjectKeys(singletonList(PROJECT_KEY))); Issue issue = issues.getIssuesList().get(0); // bulk change without notification by default - tester.wsClient().issues().bulkChange(BulkChangeRequest.builder() + tester.wsClient().issuesOld().bulkChange(BulkChangeRequest.builder() .setIssues(singletonList(issue.getKey())) .setAssign(userWithUserRole.getLogin()) .setSetSeverity("MINOR") .build()); // bulk change with notification - tester.wsClient().issues().bulkChange(BulkChangeRequest.builder() + tester.wsClient().issuesOld().bulkChange(BulkChangeRequest.builder() .setIssues(singletonList(issue.getKey())) .setSetSeverity("BLOCKER") .setSendNotifications(true) @@ -306,7 +306,7 @@ public class IssueNotificationsTest { .setName("userWithUserRole") .setEmail("userWithUserRole@nowhere.com")); tester.organizations().addMember(organization, userWithUserRole); - tester.wsClient().permissions().addUser( + tester.wsClient().permissionsOld().addUser( new AddUserRequest() .setLogin(userWithUserRole.getLogin()) .setProjectKey(PROJECT_KEY) diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java index a6984ddb4eb..0a4e7fbea19 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueSearchTest.java @@ -271,7 +271,7 @@ public class IssueSearchTest extends AbstractIssueTest { } private SearchWsResponse searchIssues(SearchRequest request) throws IOException { - return newAdminWsClient(ORCHESTRATOR).issues().search(request); + return newAdminWsClient(ORCHESTRATOR).issuesOld().search(request); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java index caf1401cffc..571b44399bb 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java @@ -77,8 +77,8 @@ public class IssueTagsTest { .build()); analyzeProject(organization.getKey(), projectKey); - String issue = tester.wsClient().issues().search(new SearchRequest()).getIssues(0).getKey(); - tester.wsClient().issues().setTags(issue, "bla", "blubb"); + String issue = tester.wsClient().issuesOld().search(new SearchRequest()).getIssues(0).getKey(); + tester.wsClient().issuesOld().setTags(issue, "bla", "blubb"); String[] publicTags = {"bad-practice", "convention", "pitfall"}; String[] privateTags = {"bad-practice", "bla", "blubb", "convention", "pitfall"}; @@ -131,7 +131,7 @@ public class IssueTagsTest { } private void grantUserPermission(String projectKey, User member) { - tester.wsClient().permissions().addUser( + tester.wsClient().permissionsOld().addUser( new AddUserRequest() .setLogin(member.getLogin()) .setPermission("user") @@ -143,7 +143,7 @@ public class IssueTagsTest { (List) ItUtils.jsonToMap( tester.as(userLogin) .wsClient() - .issues() + .issuesOld() .getTags(organization) .content()) .get("tags")).containsExactly( diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java index 632cfa5d810..97e78cff64f 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTrackingTest.java @@ -214,7 +214,7 @@ public class IssueTrackingTest extends AbstractIssueTest { } private static SearchWsResponse searchIssues(SearchRequest request) { - return adminClient.issues().search(request); + return adminClient.issuesOld().search(request); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java index 47db3ad031c..6344124f029 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueWorkflowTest.java @@ -54,7 +54,7 @@ public class IssueWorkflowTest extends AbstractIssueTest { @Before public void before() { - issuesService = newAdminWsClient(ORCHESTRATOR).issues(); + issuesService = newAdminWsClient(ORCHESTRATOR).issuesOld(); String oneIssuePerFileProfileKey = projectAnalysisRule.registerProfile("/issue/IssueWorkflowTest/xoo-one-issue-per-line-profile.xml"); String analyzedProjectKey = projectAnalysisRule.registerProject("issue/workflow"); analysisWithIssues = projectAnalysisRule.newProjectAnalysis(analyzedProjectKey).withQualityProfile(oneIssuePerFileProfileKey); @@ -308,7 +308,7 @@ public class IssueWorkflowTest extends AbstractIssueTest { } private Issues.SearchWsResponse searchIssues(SearchRequest request) { - return newAdminWsClient(ORCHESTRATOR).issues().search(request); + return newAdminWsClient(ORCHESTRATOR).issuesOld().search(request); } } diff --git a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java index 2f223fe66a1..d6a9389ecd8 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java @@ -127,7 +127,7 @@ public class OrganizationIssueAssignTest { provisionAndAnalyseProject("sample2", org2.getKey()); List issues = issueRule.search(new SearchRequest()).getIssuesList().stream().map(Issue::getKey).collect(Collectors.toList()); - Issues.BulkChangeWsResponse response = tester.wsClient().issues() + Issues.BulkChangeWsResponse response = tester.wsClient().issuesOld() .bulkChange(BulkChangeRequest.builder().setIssues(issues).setAssign(user.getLogin()).build()); assertThat(response.getIgnored()).isGreaterThan(0); @@ -204,7 +204,7 @@ public class OrganizationIssueAssignTest { } private void addQualityProfileToProject(String organization, String projectKey) { - tester.wsClient().qualityProfiles().addProject( + tester.wsClient().qualityProfilesOld().addProject( AddProjectRequest.builder() .setProjectKey(projectKey) .setOrganization(organization) @@ -214,6 +214,6 @@ public class OrganizationIssueAssignTest { } private Issues.Operation assignIssueTo(Issue issue, User u) { - return tester.wsClient().issues().assign(new AssignRequest(issue.getKey(), u.getLogin())); + return tester.wsClient().issuesOld().assign(new AssignRequest(issue.getKey(), u.getLogin())); } } diff --git a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java index 84c4c4c1bf3..30ace8285e1 100644 --- a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java @@ -63,7 +63,7 @@ public class LiteTest { @Test public void call_issues_ws() { // all issues - IssuesService issuesService = tester.wsClient().issues(); + IssuesService issuesService = tester.wsClient().issuesOld(); Issues.SearchWsResponse response = issuesService.search(new SearchRequest()); assertThat(response.getIssuesCount()).isGreaterThan(0); @@ -75,7 +75,7 @@ public class LiteTest { @Test public void call_components_ws() { // files in project - Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeRequest() + Components.TreeWsResponse tree = tester.wsClient().componentsOld().tree(new TreeRequest() .setBaseComponentKey(PROJECT_KEY) .setQualifiers(singletonList("FIL"))); assertThat(tree.getComponentsCount()).isEqualTo(4); @@ -88,7 +88,7 @@ public class LiteTest { @Test public void call_measures_ws() { // project measures - MeasuresService measuresService = tester.wsClient().measures(); + MeasuresService measuresService = tester.wsClient().measuresOld(); Measures.ComponentWsResponse component = measuresService.component(new ComponentRequest() .setComponentKey(PROJECT_KEY) .setMetricKeys(asList("lines", "ncloc", "files"))); diff --git a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java index 71f1460addf..44a55d60c64 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java @@ -59,7 +59,7 @@ public class MeasuresWsTest { public void component_tree() { scanXooSample(); - ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest() + ComponentTreeWsResponse response = tester.wsClient().measuresOld().componentTree(new ComponentTreeRequest() .setComponent("sample") .setMetricKeys(singletonList("ncloc")) .setAdditionalFields(asList("metrics", "periods"))); @@ -123,7 +123,7 @@ public class MeasuresWsTest { } private void verifyComponentTreeWithChildren(String baseComponentKey, String... childKeys) { - ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest() + ComponentTreeWsResponse response = tester.wsClient().measuresOld().componentTree(new ComponentTreeRequest() .setComponent(baseComponentKey) .setMetricKeys(singletonList("ncloc")) .setStrategy("children")); @@ -137,7 +137,7 @@ public class MeasuresWsTest { public void component() { scanXooSample(); - ComponentWsResponse response = tester.wsClient().measures().component(new ComponentRequest() + ComponentWsResponse response = tester.wsClient().measuresOld().component(new ComponentRequest() .setComponent("sample") .setMetricKeys(singletonList("ncloc")) .setAdditionalFields(newArrayList("metrics", "periods"))); diff --git a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java index 41ed941920c..9970b0a8470 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java @@ -102,7 +102,7 @@ public class TimeMachineTest { public void noDataForInterval() { Date now = new Date(); - SearchHistoryResponse response = tester.wsClient().measures().searchHistory(SearchHistoryRequest.builder() + SearchHistoryResponse response = tester.wsClient().measuresOld().searchHistory(SearchHistoryRequest.builder() .setComponent(PROJECT_KEY) .setMetrics(singletonList("lines")) .setFrom(formatDate(now)) @@ -134,7 +134,7 @@ public class TimeMachineTest { } private static SearchHistoryResponse searchHistory(String... metrics) { - return tester.wsClient().measures().searchHistory(SearchHistoryRequest.builder() + return tester.wsClient().measuresOld().searchHistory(SearchHistoryRequest.builder() .setComponent(PROJECT_KEY) .setMetrics(Arrays.asList(metrics)) .build()); diff --git a/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java b/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java index 3ee724c08a4..78498fa03a5 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java @@ -127,7 +127,7 @@ public class BillingTest { public void does_not_fail_to_update_default_projects_visibility_to_private() { tester.settings().setGlobalSettings("sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false"); - tester.wsClient().organizations().updateProjectVisibility(UpdateProjectVisibilityRequest.builder() + tester.wsClient().organizationsOld().updateProjectVisibility(UpdateProjectVisibilityRequest.builder() .setOrganization(organization.getKey()) .setProjectVisibility("private") .build()); @@ -142,7 +142,7 @@ public class BillingTest { expectHttpError(400, format("Organization %s cannot use private project", organization.getKey()), - () -> tester.wsClient().organizations() + () -> tester.wsClient().organizationsOld() .updateProjectVisibility(UpdateProjectVisibilityRequest.builder().setOrganization(organization.getKey()).setProjectVisibility("private").build())); } diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java index 27168955514..2fcb812f7bf 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java @@ -78,7 +78,7 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); tester.organizations().assertThatMemberOf(organization, user); removeMembership(organization, user); @@ -91,10 +91,10 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); tester.organizations().assertThatMemberOf(organization, user); // Admin is the creator of the organization so he was granted with admin permission - tester.wsClient().organizations().removeMember(organization.getKey(), "admin"); + tester.wsClient().organizationsOld().removeMember(organization.getKey(), "admin"); expectedException.expect(HttpException.class); expectedException.expectMessage("The last administrator member cannot be removed"); @@ -125,6 +125,6 @@ public class OrganizationMembershipTest { } private void removeMembership(Organization organization, User user) { - tester.wsClient().organizations().removeMember(organization.getKey(), user.getLogin()); + tester.wsClient().organizationsOld().removeMember(organization.getKey(), user.getLogin()); } } diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java index 8995f90a42d..462e4b2f1ee 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java @@ -206,7 +206,7 @@ public class OrganizationTest { "sonar.organization", organization.getKey(), "sonar.login", user.getLogin(), "sonar.password", user.getLogin()); - ComponentsService componentsService = tester.as(user.getLogin()).wsClient().components(); + ComponentsService componentsService = tester.as(user.getLogin()).wsClient().componentsOld(); assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1); } @@ -222,7 +222,7 @@ public class OrganizationTest { assertThat(e.getResult().getLogs()).contains("Insufficient privileges"); } - ComponentsService componentsService = tester.wsClient().components(); + ComponentsService componentsService = tester.wsClient().componentsOld(); assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsCount()).isEqualTo(0); } @@ -232,12 +232,12 @@ public class OrganizationTest { runProjectAnalysis(orchestrator, "shared/xoo-sample", "sonar.organization", organization.getKey(), "sonar.login", "admin", "sonar.password", "admin"); - ComponentsService componentsService = tester.asAnonymous().wsClient().components(); + ComponentsService componentsService = tester.asAnonymous().wsClient().componentsOld(); assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1); } private void addPermissionsToUser(String orgKeyAndName, String login, String permission, String... otherPermissions) { - PermissionsService permissionsService = tester.wsClient().permissions(); + PermissionsService permissionsService = tester.wsClient().permissionsOld(); permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(permission)); for (String otherPermission : otherPermissions) { permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(otherPermission)); @@ -252,7 +252,7 @@ public class OrganizationTest { "sonar.organization", organization.getKey(), "sonar.login", "admin", "sonar.password", "admin"); - ComponentsService componentsService = tester.wsClient().components(); + ComponentsService componentsService = tester.wsClient().componentsOld(); assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1); tester.organizations().service().delete(organization.getKey()); @@ -341,7 +341,7 @@ public class OrganizationTest { private void assertThatBuiltInQualityProfilesExist(Organization org) { org.sonarqube.ws.client.qualityprofile.SearchRequest profilesRequest = new org.sonarqube.ws.client.qualityprofile.SearchRequest() .setOrganizationKey(org.getKey()); - Qualityprofiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest); + Qualityprofiles.SearchWsResponse response = tester.wsClient().qualityProfilesOld().search(profilesRequest); assertThat(response.getProfilesCount()).isGreaterThan(0); response.getProfilesList().forEach(p -> { @@ -362,7 +362,7 @@ public class OrganizationTest { } private void assertThatQualityProfilesDoNotExist(Organization org) { - expectNotFoundError(() -> tester.wsClient().qualityProfiles().search( + expectNotFoundError(() -> tester.wsClient().qualityProfilesOld().search( new org.sonarqube.ws.client.qualityprofile.SearchRequest().setOrganizationKey(org.getKey()))); } } diff --git a/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java b/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java index ac98f4e7d42..aeaf297a844 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java @@ -52,7 +52,7 @@ public class PersonalOrganizationTest { public void personal_organizations_are_created_for_new_users() { Users.CreateWsResponse.User user = tester.users().generate(); - List existing = tester.wsClient().organizations().search(SearchRequest.builder().build()).getOrganizationsList(); + List existing = tester.wsClient().organizationsOld().search(SearchRequest.builder().build()).getOrganizationsList(); assertThat(existing) .filteredOn(Organizations.Organization::getGuarded) .filteredOn(o -> o.getKey().equals(user.getLogin())) diff --git a/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java b/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java index 0ded98c31a3..f0e6590a6e0 100644 --- a/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java @@ -80,7 +80,7 @@ public class DuplicationTest extends AbstractPerfTest { } private Map getMeasures(String key) { - return newWsClient().measures().component(new ComponentRequest() + return newWsClient().measuresOld().component(new ComponentRequest() .setComponentKey(key) .setMetricKeys(asList("duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density"))) .getComponent().getMeasuresList() diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java index 770e83b8192..6b5a48383a4 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java @@ -68,7 +68,7 @@ public class ProjectBulkDeletionPageTest { $(".modal button").click(); $("#projects-management-page").shouldNotHave(text(project1.getName())).shouldNotHave(text(project3.getName())); - assertThat(tester.wsClient().components().searchProjects(SearchProjectsRequest.builder().build()) + assertThat(tester.wsClient().componentsOld().searchProjects(SearchProjectsRequest.builder().build()) .getComponentsCount()).isEqualTo(1); } } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java index be1b0b441e6..8216d8897da 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java @@ -202,7 +202,7 @@ public class ProjectDeletionTest { * Projects page - api/components/search_projects - uses ES + DB */ private boolean isInComponentSearchProjects(String name) { - Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); return response.getComponentsCount() > 0; } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java index 95f4a73fdbc..3972f771c78 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java @@ -291,7 +291,7 @@ public class ProjectFilterTest { } private SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) throws IOException { - return tester.wsClient().components().searchProjects(request); + return tester.wsClient().componentsOld().searchProjects(request); } private void verifyFilterMatches(String projectKey, String filter) throws IOException { diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java index d209d9154f5..2ab5e74158d 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java @@ -71,7 +71,7 @@ public class ProjectKeyUpdateTest { public void update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - Components.Component project = tester.wsClient().components().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().componentsOld().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); tester.wsClient().projects().updateKey(UpdateKeyRequest.builder() @@ -79,14 +79,14 @@ public class ProjectKeyUpdateTest { .setNewKey(newProjectKey) .build()); - assertThat(tester.wsClient().components().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + assertThat(tester.wsClient().componentsOld().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); } @Test public void bulk_update_key() { analyzeXooSample(); String newProjectKey = "another_project_key"; - Components.Component project = tester.wsClient().components().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); + Components.Component project = tester.wsClient().componentsOld().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent(); assertThat(project.getKey()).isEqualTo(PROJECT_KEY); Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyRequest.builder() @@ -95,7 +95,7 @@ public class ProjectKeyUpdateTest { .setTo(newProjectKey) .build()); - assertThat(tester.wsClient().components().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + assertThat(tester.wsClient().componentsOld().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); assertThat(result.getKeysCount()).isEqualTo(1); assertThat(result.getKeys(0)) .extracting(Projects.BulkUpdateKeyWsResponse.Key::getKey, Projects.BulkUpdateKeyWsResponse.Key::getNewKey, Projects.BulkUpdateKeyWsResponse.Key::getDuplicate) @@ -254,7 +254,7 @@ public class ProjectKeyUpdateTest { */ @CheckForNull private String keyInComponentSearchProjects(String name) { - Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); if (response.getComponentsCount() > 0) { return response.getComponents(0).getKey(); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java index 4eb51516718..1faa8d031e3 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java @@ -109,7 +109,7 @@ public class ProjectProvisioningTest { * Projects page - api/components/search_projects - uses ES + DB */ private boolean isInComponentSearchProjects(String name) { - Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects( + Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects( SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build()); return response.getComponentsCount() > 0; } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java index cc7546065c2..0f9c90fb04e 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java @@ -57,7 +57,7 @@ public class ProjectVisibilityPageTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample2")); tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("sample2").setVisibility("private").build()); // Remove 'Admin' permission for admin group on project 2 -> No one can access or admin this project, expect System Admin - tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); + tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); tester.openBrowser().logIn().submitCredentials(adminUser) .openProjectsManagement("default-organization") @@ -84,7 +84,7 @@ public class ProjectVisibilityPageTest { .createProject("foo", "foo", visibility) .shouldHaveProjectsCount(1); - Components.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).components().searchProjects( + Components.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).componentsOld().searchProjects( SearchProjectsRequest.builder().build()); assertThat(response.getComponentsCount()).isEqualTo(1); assertThat(response.getComponents(0).getKey()).isEqualTo("foo"); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java index 30fff3e7545..2cf644cfaa1 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java @@ -59,7 +59,7 @@ public class OrganizationQualityGateUiTest { organization = tester.organizations().generate(); gateAdmin = tester.users().generate(); tester.organizations().addMember(tester.organizations().getDefaultOrganization(), gateAdmin); - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); user = tester.users().generate(); tester.organizations().addMember(organization, user); restoreProfile(orchestrator, getClass().getResource("/issue/with-many-rules.xml"), organization.getKey()); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java index 718ef39a601..708af300823 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java @@ -256,7 +256,7 @@ public class QualityGateTest { // user is quality gate admin of default organization Organization organization = tester.organizations().getDefaultOrganization(); Users.CreateWsResponse.User user = tester.users().generateMember(organization); - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); TesterSession qGateAdminTester = tester.as(user.getLogin()); QualitygatesService qGateService = qGateAdminTester.qGates().service(); // perform administration operations diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java index 6e2ef0c0674..3ecb8d97e70 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtInIssueChangelogTest.java @@ -58,7 +58,7 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.oneIssuePerFile.effortToFix", "10")); - Issues.Issue firstIssue = tester.wsClient().issues().search(new SearchRequest()).getIssues(0); + Issues.Issue firstIssue = tester.wsClient().issuesOld().search(new SearchRequest()).getIssues(0); List changes = changelog(firstIssue.getKey()).getChangelogList(); assertThat(changes).hasSize(1); @@ -68,7 +68,7 @@ public class TechnicalDebtInIssueChangelogTest { } private Issues.ChangelogWsResponse changelog(String issueKey) { - return tester.wsClient().issues().changelog(issueKey); + return tester.wsClient().issuesOld().changelog(issueKey); } } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java index 24d60d3b88a..a941680436e 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtTest.java @@ -54,7 +54,7 @@ public class TechnicalDebtTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // All the issues should have a technical debt - List issues = tester.wsClient().issues().search(new SearchRequest()).getIssuesList(); + List issues = tester.wsClient().issuesOld().search(new SearchRequest()).getIssuesList(); assertThat(issues).isNotEmpty(); for (Issues.Issue issue : issues) { assertThat(issue.getDebt()).isEqualTo("1min"); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java index ef08e8e8317..c857eab45bd 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -77,7 +77,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); orchestrator.restartServer(); @@ -100,19 +100,19 @@ public class BuiltInQualityProfilesNotificationTest { // Create a quality profile administrator (user having direct permission) Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // Create a quality profile administrator (user having permission from a group) Users.CreateWsResponse.User profileAdmin2 = userRule.generate(); String groupName = randomAlphanumeric(20); wsClient.wsConnector().call(new PostRequest("api/user_groups/create").setParam("name", groupName)).failIfNotSuccessful(); - wsClient.permissions().addGroup(new AddGroupRequest().setPermission("profileadmin").setGroupName(groupName)); + wsClient.permissionsOld().addGroup(new AddGroupRequest().setPermission("profileadmin").setGroupName(groupName)); wsClient.wsConnector().call(new PostRequest("api/user_groups/add_user").setParam("name", groupName).setParam("login", profileAdmin2.getLogin())).failIfNotSuccessful(); // Create a user not being quality profile administrator Users.CreateWsResponse.User noProfileAdmin = userRule.generate(); // Create a child profile on the built-in profile => The notification should not take into account updates of this profile - wsClient.qualityProfiles().create(CreateRequest.builder().setLanguage("foo").setName("child").build()); - wsClient.qualityProfiles().changeParent(ChangeParentRequest.builder().setProfileName("child").setParentName("Basic").setLanguage("foo").build()); + wsClient.qualityProfilesOld().create(CreateRequest.builder().setLanguage("foo").setName("child").build()); + wsClient.qualityProfilesOld().changeParent(ChangeParentRequest.builder().setProfileName("child").setParentName("Basic").setLanguage("foo").build()); // uninstall plugin V1 wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful(); @@ -156,7 +156,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // uninstall plugin V1 wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful(); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java index d9445e5896d..83c7f9e7b51 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java @@ -184,7 +184,7 @@ public class OrganizationQualityProfilesUiTest { } private void inheritProfile(String language, String name, String parentName) { - tester.wsClient().qualityProfiles().changeParent(ChangeParentRequest.builder() + tester.wsClient().qualityProfilesOld().changeParent(ChangeParentRequest.builder() .setLanguage(language) .setProfileName(name) .setParentName(parentName) @@ -200,7 +200,7 @@ public class OrganizationQualityProfilesUiTest { } private void addProfileToProject(String language, String profileName, String projectKey) { - tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder() + tester.wsClient().qualityProfilesOld().addProject(AddProjectRequest.builder() .setLanguage(language) .setQualityProfile(profileName) .setProjectKey(projectKey) diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java index 9598bb0432f..4d9b88c18cd 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java @@ -226,7 +226,7 @@ public class QualityProfilesEditTest { Organization organization = tester.organizations().generate(); User user = tester.users().generateMember(organization); CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); - tester.wsClient().permissions().addUser(new AddUserRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); SearchWsResponse result = tester.as(user.getLogin()) .qProfiles().service().search(new SearchRequest().setOrganizationKey(organization.getKey())); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java index 47249a3138c..71ff0ad3755 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java @@ -154,14 +154,14 @@ public class QualityProfilesUiTest { } private void createProfile(String language, String name) { - tester.wsClient().qualityProfiles().create(CreateRequest.builder() + tester.wsClient().qualityProfilesOld().create(CreateRequest.builder() .setLanguage(language) .setName(name) .build()); } private void inheritProfile(String language, String name, String parentName) { - tester.wsClient().qualityProfiles().changeParent(ChangeParentRequest.builder() + tester.wsClient().qualityProfilesOld().changeParent(ChangeParentRequest.builder() .setLanguage(language) .setProfileName(name) .setParentName(parentName) @@ -173,7 +173,7 @@ public class QualityProfilesUiTest { } private void addProfileToProject(String language, String profileName, String projectKey) { - tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder() + tester.wsClient().qualityProfilesOld().addProject(AddProjectRequest.builder() .setLanguage(language) .setQualityProfile(profileName) .setProjectKey(projectKey) diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java index f7837897556..e39af31e2c0 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java @@ -133,7 +133,7 @@ public class QualityProfilesWsTest { Organization org = tester.organizations().generate(); CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(org); - String changelog = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() + String changelog = tester.wsClient().qualityProfilesOld().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) @@ -143,14 +143,14 @@ public class QualityProfilesWsTest { tester.qProfiles().activateRule(profile, RULE_ONE_BUG_PER_LINE); tester.qProfiles().activateRule(profile, RULE_ONE_ISSUE_PER_LINE); - String changelog2 = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() + String changelog2 = tester.wsClient().qualityProfilesOld().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) .build()); JSONAssert.assertEquals(EXPECTED_CHANGELOG, changelog2, JSONCompareMode.LENIENT); - String changelog3 = tester.wsClient().qualityProfiles().changelog(ChangelogRequest.builder() + String changelog3 = tester.wsClient().qualityProfilesOld().changelog(ChangelogRequest.builder() .setOrganization(org.getKey()) .setLanguage(profile.getLanguage()) .setQualityProfile(profile.getName()) diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java index d312aa09a3c..efea4d8615a 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/LogsTest.java @@ -116,7 +116,7 @@ public class LogsTest { private void generateSqlAndEsLogsInWebAndCe() { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); - ItUtils.newAdminWsClient(orchestrator).issues().search(new SearchRequest() + ItUtils.newAdminWsClient(orchestrator).issuesOld().search(new SearchRequest() .setProjectKeys(Collections.singletonList("sample"))); } diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java index 17bf6776746..a3f4c86e588 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java @@ -97,7 +97,7 @@ public class RestartTest { private void createSystemAdministrator(String login, String password) { WsClient wsClient = newAdminWsClient(orchestrator); createNonSystemAdministrator(wsClient, login, password); - wsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); + wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); } private void createNonSystemAdministrator(String login, String password) { diff --git a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java index 35741444b28..5cc0d4cee00 100644 --- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java @@ -81,7 +81,7 @@ public class SettingsTest { userRule.createUser("scanner-user", "scanner-user"); adminWsClient = newAdminWsClient(orchestrator); // Remove 'Execute Analysis' permission from anyone - adminWsClient.permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("scan")); // Anonymous user, without 'Execute Analysis' permission anonymousSettingsService = newWsClient(orchestrator).settings(); @@ -90,7 +90,7 @@ public class SettingsTest { userSettingsService = newUserWsClient(orchestrator, "setting-user", "setting-user").settings(); // User with 'Execute Analysis' permission - adminWsClient.permissions().addUser(new AddUserRequest().setLogin("scanner-user").setPermission("scan")); + adminWsClient.permissionsOld().addUser(new AddUserRequest().setLogin("scanner-user").setPermission("scan")); scanSettingsService = newUserWsClient(orchestrator, "scanner-user", "scanner-user").settings(); // User with 'Administer System' permission but without 'Execute Analysis' permission @@ -101,7 +101,7 @@ public class SettingsTest { public static void tearDown() throws Exception { userRule.deactivateUsers("setting-user", "scanner-user"); // Restore 'Execute Analysis' permission to anyone - adminWsClient.permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissionsOld().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("scan")); } @After diff --git a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java index 9f5f1a87b9f..f929798ec84 100644 --- a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java +++ b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java @@ -198,7 +198,7 @@ public class UpgradeTest { } private int countFiles(String key) { - Measure measure = newWsClient(orchestrator).measures().component(new ComponentRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files"))) + Measure measure = newWsClient(orchestrator).measuresOld().component(new ComponentRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files"))) .getComponent().getMeasures(0); return parseInt(measure.getValue()); } diff --git a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java index 7e9a294fc49..051483275f1 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java @@ -125,7 +125,7 @@ public class OAuth2IdentityProviderTest { enablePlugin(); tester.users().generate(u -> u.setLogin(USER_LOGIN)); // Give user global admin permission as we want to go to a page where authentication is required - tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(USER_LOGIN).setPermission("admin")); + tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(USER_LOGIN).setPermission("admin")); Navigation nav = tester.openBrowser(); // Try to go to the settings page diff --git a/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java index d3edfa5b92a..0fdfabbdaed 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java @@ -83,7 +83,7 @@ public class OrganizationIdentityProviderTest { Group group = tester.groups().generate(null); User user = tester.users().generate(); // Add user as member of default organization - tester.wsClient().organizations().addMember("default-organization", user.getLogin()); + tester.wsClient().organizationsOld().addMember("default-organization", user.getLogin()); tester.groups().assertThatUserIsMemberOf(null, user.getLogin(), "Members"); enableUserCreationByAuthPlugin(user.getLogin()); // No group is returned by the plugin diff --git a/tests/src/test/java/util/ItUtils.java b/tests/src/test/java/util/ItUtils.java index 9d09abf7dfb..6ac8775f635 100644 --- a/tests/src/test/java/util/ItUtils.java +++ b/tests/src/test/java/util/ItUtils.java @@ -334,7 +334,7 @@ public class ItUtils { } private static Stream getStreamMeasures(Orchestrator orchestrator, String componentKey, String... metricKeys) { - return newWsClient(orchestrator).measures().component(new ComponentRequest() + return newWsClient(orchestrator).measuresOld().component(new ComponentRequest() .setComponent(componentKey) .setMetricKeys(asList(metricKeys))) .getComponent().getMeasuresList() @@ -343,7 +343,7 @@ public class ItUtils { @CheckForNull public static Measure getMeasureWithVariation(Orchestrator orchestrator, String componentKey, String metricKey) { - Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentRequest() + Measures.ComponentWsResponse response = newWsClient(orchestrator).measuresOld().component(new ComponentRequest() .setComponent(componentKey) .setMetricKeys(singletonList(metricKey)) .setAdditionalFields(singletonList("periods"))); @@ -353,7 +353,7 @@ public class ItUtils { @CheckForNull public static Map getMeasuresWithVariationsByMetricKey(Orchestrator orchestrator, String componentKey, String... metricKeys) { - return newWsClient(orchestrator).measures().component(new ComponentRequest() + return newWsClient(orchestrator).measuresOld().component(new ComponentRequest() .setComponentKey(componentKey) .setMetricKeys(asList(metricKeys)) .setAdditionalFields(singletonList("periods"))).getComponent().getMeasuresList() @@ -373,7 +373,7 @@ public class ItUtils { @CheckForNull public static Component getComponent(Orchestrator orchestrator, String componentKey) { try { - return newWsClient(orchestrator).components().show(new ShowRequest().setKey((componentKey))).getComponent(); + return newWsClient(orchestrator).componentsOld().show(new ShowRequest().setKey((componentKey))).getComponent(); } catch (org.sonarqube.ws.client.HttpException e) { if (e.code() == 404) { return null; @@ -403,7 +403,7 @@ public class ItUtils { throw new IllegalArgumentException("Cannot find quality profile xml file '" + resource + "' in classpath"); } newAdminWsClient(orchestrator) - .qualityProfiles() + .qualityProfilesOld() .restoreProfile( RestoreRequest.builder() .setBackup(new File(uri)) diff --git a/tests/src/test/java/util/issue/IssueRule.java b/tests/src/test/java/util/issue/IssueRule.java index c055a2b4385..0d1b750b7f3 100644 --- a/tests/src/test/java/util/issue/IssueRule.java +++ b/tests/src/test/java/util/issue/IssueRule.java @@ -48,7 +48,7 @@ public class IssueRule extends ExternalResource { } public SearchWsResponse search(SearchRequest request) { - return adminWsClient().issues().search(request); + return adminWsClient().issuesOld().search(request); } public Issue getRandomIssue() { diff --git a/tests/src/test/java/util/user/UserRule.java b/tests/src/test/java/util/user/UserRule.java index 9c2db03e6e7..ed409b21139 100644 --- a/tests/src/test/java/util/user/UserRule.java +++ b/tests/src/test/java/util/user/UserRule.java @@ -147,7 +147,7 @@ public class UserRule extends ExternalResource implements GroupManagement { public String createAdminUser(String login, String password) { createUser(login, password); - adminWsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); + adminWsClient.permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); adminWsClient.userGroups().addUser(new org.sonarqube.ws.client.usergroups.AddUserRequest().setLogin(login).setName("sonar-administrators")); return login; } -- 2.39.5