aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-21 12:13:17 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-22 14:37:22 +0100
commit77c74b5dcda9caf69646b87519ea3395716f7552 (patch)
tree97b2cf017d21a1c9ee0d35081da8f1e4109cb20d /server
parentb290847475f39b5c077c34345de7a65f5f11b261 (diff)
downloadsonarqube-77c74b5dcda9caf69646b87519ea3395716f7552.tar.gz
sonarqube-77c74b5dcda9caf69646b87519ea3395716f7552.zip
Drop unused methods in UserDbTester
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDbTester.java60
1 files changed, 2 insertions, 58 deletions
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDbTester.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDbTester.java
index b3e92dea7d6..8f8c2e49c84 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDbTester.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDbTester.java
@@ -34,8 +34,6 @@ import org.sonar.db.permission.GroupPermissionDto;
import org.sonar.db.permission.UserPermissionDto;
import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN;
import static org.sonar.db.user.GroupTesting.newGroupDto;
import static org.sonar.db.user.UserTesting.newUserDto;
@@ -83,38 +81,12 @@ public class UserDbTester {
return dbClient.userDao().selectByLogin(db.getSession(), userDto.getLogin());
}
- public UserDto insertRootByUserPermission(String login) {
- return insertRootByUserPermissionImpl(requireNonNull(login));
- }
-
- private UserDto insertRootByUserPermissionImpl(@Nullable String login) {
- UserDto rootByUserPermissionUser = makeRoot(login == null ? insertUser() : insertUser(login));
- insertPermissionOnUser(db.getDefaultOrganization(), rootByUserPermissionUser, SYSTEM_ADMIN);
- return rootByUserPermissionUser;
- }
-
-
-
public UserDto insertAdminByUserPermission(OrganizationDto org) {
- UserDto user = db.users().insertUser();
- db.users().insertPermissionOnUser(org, user, GlobalPermissions.SYSTEM_ADMIN);
+ UserDto user = insertUser();
+ insertPermissionOnUser(org, user, GlobalPermissions.SYSTEM_ADMIN);
return user;
}
- private GroupDto createOrCheckAdminGroup(@Nullable GroupDto groupDto) {
- if (groupDto == null) {
- GroupDto adminGroup = insertGroup(db.getDefaultOrganization());
- insertPermissionOnGroup(adminGroup, SYSTEM_ADMIN);
- return adminGroup;
- }
- checkArgument(
- groupDto.getOrganizationUuid().equals(db.getDefaultOrganization().getUuid()),
- "Group '%s' must belong to the default organization", groupDto.getName());
- List<String> groupPermissions = db.getDbClient().groupPermissionDao().selectGlobalPermissionsOfGroup(db.getSession(), groupDto.getOrganizationUuid(), groupDto.getId());
- checkArgument(groupPermissions.contains(SYSTEM_ADMIN), "Group '%s' must have permission '%s'", groupDto.getId(), SYSTEM_ADMIN);
- return groupDto;
- }
-
public Optional<UserDto> selectUserByLogin(String login) {
return Optional.ofNullable(dbClient.userDao().selectByLogin(db.getSession(), login));
}
@@ -135,34 +107,6 @@ public class UserDbTester {
}
/**
- * Creates a group in the default organization with {@link GlobalPermissions#SYSTEM_ADMIN} permission.
- */
- public GroupDto insertAdminGroup() {
- GroupDto groupDto = insertGroup();
- insertPermissionOnGroup(groupDto, SYSTEM_ADMIN);
- return groupDto;
- }
-
- /**
- * Creates a group in the specified organization with {@link GlobalPermissions#SYSTEM_ADMIN} permission.
- */
- public GroupDto insertAdminGroup(OrganizationDto organizationDto) {
- GroupDto groupDto = insertGroup(organizationDto);
- insertPermissionOnGroup(groupDto, SYSTEM_ADMIN);
- return groupDto;
- }
-
- /**
- * Creates a group with the specified name in the specified organization with {@link GlobalPermissions#SYSTEM_ADMIN}
- * permission.
- */
- public GroupDto insertAdminGroup(OrganizationDto organizationDto, String name) {
- GroupDto groupDto = insertGroup(organizationDto, name);
- insertPermissionOnGroup(groupDto, SYSTEM_ADMIN);
- return groupDto;
- }
-
- /**
* Create group in specified organization
*/
public GroupDto insertGroup(OrganizationDto organizationDto) {