aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-qa-util
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-qa-util')
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java10
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java11
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java9
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java15
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QProfileTester.java4
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java8
6 files changed, 31 insertions, 26 deletions
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java
index 8b395c90518..7a3bd5e8fca 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/GroupTester.java
@@ -26,9 +26,9 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUserGroups;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse.Group;
+import org.sonarqube.ws.UserGroups;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.GroupsWsResponse.Group;
import org.sonarqube.ws.client.user.GroupsRequest;
import org.sonarqube.ws.client.usergroup.AddUserWsRequest;
import org.sonarqube.ws.client.usergroup.CreateWsRequest;
@@ -47,7 +47,7 @@ public class GroupTester {
}
@SafeVarargs
- public final WsUserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer<CreateWsRequest.Builder>... populators) {
+ public final UserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer<CreateWsRequest.Builder>... populators) {
int id = ID_GENERATOR.getAndIncrement();
CreateWsRequest.Builder request = CreateWsRequest.builder()
.setName("Group" + id)
@@ -62,7 +62,7 @@ public class GroupTester {
.setOrganization(organization != null ? organization.getKey() : null)
.setLogin(userLogin)
.build();
- WsUsers.GroupsWsResponse response = session.users().service().groups(request);
+ Users.GroupsWsResponse response = session.users().service().groups(request);
return response.getGroupsList();
}
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 a9d098ee261..08c317c6d40 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
@@ -25,7 +25,7 @@ import java.util.function.Consumer;
import javax.annotation.Nullable;
import org.assertj.core.api.Assertions;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.organization.CreateWsRequest;
@@ -35,7 +35,6 @@ import org.sonarqube.ws.client.organization.SearchWsRequest;
import org.sonarqube.ws.client.user.GroupsRequest;
import static java.util.Arrays.stream;
-import static org.assertj.core.api.Assertions.assertThat;
public class OrganizationTester {
@@ -70,7 +69,7 @@ public class OrganizationTester {
return service().create(request.build()).getOrganization();
}
- public OrganizationTester addMember(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester addMember(Organizations.Organization organization, Users.CreateWsResponse.User user) {
service().addMember(organization.getKey(), user.getLogin());
return this;
}
@@ -89,7 +88,7 @@ public class OrganizationTester {
return this;
}
- public OrganizationTester assertThatMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester assertThatMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) {
return assertThatMemberOf(organization, user.getLogin());
}
@@ -99,7 +98,7 @@ public class OrganizationTester {
return this;
}
- public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) {
return assertThatNotMemberOf(organization, user.getLogin());
}
@@ -126,7 +125,7 @@ public class OrganizationTester {
}
private void verifyMembersGroupMembership(String userLogin, @Nullable Organizations.Organization organization, boolean isMember) {
- List<WsUsers.GroupsWsResponse.Group> groups = session.wsClient().users().groups(GroupsRequest.builder()
+ List<Users.GroupsWsResponse.Group> groups = session.wsClient().users().groups(GroupsRequest.builder()
.setLogin(userLogin)
.setOrganization(organization != null ? organization.getKey() : null)
.setQuery("Members")
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java
index 6b63e850ee2..9c48acaf47b 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java
@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsProjects;
+import org.sonarqube.ws.Projects;
import org.sonarqube.ws.client.project.CreateRequest;
import org.sonarqube.ws.client.project.DeleteRequest;
import org.sonarqube.ws.client.project.ProjectsService;
@@ -49,7 +49,12 @@ public class ProjectTester {
}
@SafeVarargs
- public final WsProjects.CreateWsResponse.Project generate(@Nullable Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
+ public final Projects.CreateWsResponse.Project provision(Consumer<CreateRequest.Builder>... populators) {
+ return provision(null, populators);
+ }
+
+ @SafeVarargs
+ public final Projects.CreateWsResponse.Project provision(@Nullable Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
int id = ID_GENERATOR.getAndIncrement();
CreateRequest.Builder request = CreateRequest.builder()
.setKey("key" + id)
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
index e0a1f8bae53..5db54abe49f 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
@@ -24,12 +24,13 @@ import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.qualitygate.QualityGatesService;
-import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
+import org.sonarqube.ws.client.qualitygates.CreateRequest;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
+import org.sonarqube.ws.client.qualitygates.SelectRequest;
public class QGateTester {
private static final AtomicInteger ID_GENERATOR = new AtomicInteger();
@@ -40,7 +41,7 @@ public class QGateTester {
this.session = session;
}
- public QualityGatesService service() {
+ public QualitygatesService service() {
return session.wsClient().qualityGates();
}
@@ -54,11 +55,11 @@ public class QGateTester {
public CreateWsResponse generate() {
int id = ID_GENERATOR.getAndIncrement();
- return session.wsClient().qualityGates().create("QualityGate" + id);
+ return session.wsClient().qualityGates().create(new CreateRequest().setName("QualityGate" + id));
}
public void associateProject(CreateWsResponse qualityGate, Project project){
- service().associateProject(new SelectWsRequest().setGateId(qualityGate.getId()).setProjectKey(project.getKey()));
+ service().select(new SelectRequest().setGateId(String.valueOf(qualityGate.getId())).setProjectKey(project.getKey()));
}
public static class ListResponse {
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 2c80d28fe2c..25ac4c79602 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,9 +25,9 @@ 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.QualityProfiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
import org.sonarqube.ws.Rules;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.qualityprofile.ActivateRuleWsRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
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 72e3cb5126e..8b38ca267a2 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
@@ -24,8 +24,8 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.user.CreateRequest;
import org.sonarqube.ws.client.user.SearchRequest;
@@ -122,8 +122,8 @@ public class UserTester {
return session.wsClient().users();
}
- public Optional<WsUsers.SearchWsResponse.User> getByLogin(String login) {
- List<WsUsers.SearchWsResponse.User> users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList();
+ public Optional<Users.SearchWsResponse.User> getByLogin(String login) {
+ List<Users.SearchWsResponse.User> users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList();
if (users.size() == 1) {
return Optional.of(users.get(0));
}