aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-qa-util
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-12-02 16:17:48 +0100
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-12-06 14:40:17 +0100
commit460bb1a793ad325312c5d0644dbd3753d4835207 (patch)
treef28e95fbdc53bdb220dc7e2a3f0f21d06c5ad77a /server/sonar-qa-util
parent9cba9e0a34bd4b7fa24a7b9c9b8616c0c47273da (diff)
downloadsonarqube-460bb1a793ad325312c5d0644dbd3753d4835207.tar.gz
sonarqube-460bb1a793ad325312c5d0644dbd3753d4835207.zip
Remove legacy sonar-ws code for qualityprofiles
Diffstat (limited to 'server/sonar-qa-util')
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java37
1 files changed, 18 insertions, 19 deletions
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 c28530f86de..312db3c9ed7 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
@@ -25,14 +25,15 @@ import java.util.function.Consumer;
import org.assertj.core.api.Assertions;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Organizations.Organization;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
import org.sonarqube.ws.Rules;
-import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.HttpException;
-import org.sonarqube.ws.client.qualityprofile.ActivateRuleRequest;
-import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
-import org.sonarqube.ws.client.qualityprofile.CreateRequest;
-import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
+import org.sonarqube.ws.client.qualityprofiles.ActivateRuleRequest;
+import org.sonarqube.ws.client.qualityprofiles.AddProjectRequest;
+import org.sonarqube.ws.client.qualityprofiles.CreateRequest;
+import org.sonarqube.ws.client.qualityprofiles.DeactivateRuleRequest;
+import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
import org.sonarqube.ws.client.rules.SearchRequest;
import static java.util.Arrays.asList;
@@ -49,19 +50,19 @@ public class QProfileTester {
this.session = session;
}
- public QualityProfilesService service() {
- return session.wsClient().qualityProfilesOld();
+ public QualityprofilesService service() {
+ return session.wsClient().qualityprofiles();
}
@SafeVarargs
- public final QualityProfile createXooProfile(Organization organization, Consumer<CreateRequest.Builder>... populators) {
+ public final QualityProfile createXooProfile(Organization organization, Consumer<CreateRequest>... populators) {
int id = ID_GENERATOR.getAndIncrement();
- CreateRequest.Builder request = CreateRequest.builder()
- .setOrganizationKey(organization.getKey())
+ CreateRequest request = new CreateRequest()
+ .setOrganization(organization.getKey())
.setLanguage("xoo")
.setName("Profile" + id);
stream(populators).forEach(p -> p.accept(request));
- return service().create(request.build()).getProfile();
+ return service().create(request).getProfile();
}
public QProfileTester activateRule(QualityProfile profile, String ruleKey) {
@@ -69,24 +70,22 @@ public class QProfileTester {
}
public QProfileTester activateRule(String profileKey, String ruleKey) {
- ActivateRuleRequest request = ActivateRuleRequest.builder()
+ ActivateRuleRequest request = new ActivateRuleRequest()
.setKey(profileKey)
- .setRuleKey(ruleKey)
- .build();
+ .setRule(ruleKey);
service().activateRule(request);
return this;
}
public QProfileTester deactivateRule(QualityProfile profile, String ruleKey) {
- service().deactivateRule(profile.getKey(), ruleKey);
+ service().deactivateRule(new DeactivateRuleRequest().setKey(profile.getKey()).setRule(ruleKey));
return this;
}
public QProfileTester assignQProfileToProject(QualityProfile profile, Project project) {
- service().addProject(AddProjectRequest.builder()
- .setProjectKey(project.getKey())
- .setKey(profile.getKey())
- .build());
+ service().addProject(new AddProjectRequest()
+ .setProject(project.getKey())
+ .setKey(profile.getKey()));
return this;
}