diff options
19 files changed, 20 insertions, 108 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index 4fe2f430a13..689e56ee4d7 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -50,8 +50,6 @@ import org.sonar.core.platform.Module; import org.sonar.core.platform.PluginClassloaderFactory; import org.sonar.core.platform.PluginLoader; import org.sonar.core.timemachine.Periods; -import org.sonar.core.user.DefaultUserFinder; -import org.sonar.core.user.DeprecatedUserFinder; import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.DaoModule; import org.sonar.db.DatabaseChecker; @@ -126,6 +124,8 @@ import org.sonar.server.rule.index.RuleIndexer; import org.sonar.server.search.EsSearchModule; import org.sonar.server.startup.LogServerId; import org.sonar.server.test.index.TestIndexer; +import org.sonar.server.user.DefaultUserFinder; +import org.sonar.server.user.DeprecatedUserFinder; import org.sonar.server.user.index.UserIndex; import org.sonar.server.user.index.UserIndexer; import org.sonar.server.view.index.ViewIndex; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 9e70631f342..ef7a11a4c0c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -32,8 +32,6 @@ import org.sonar.api.server.rule.RulesDefinitionXmlLoader; import org.sonar.ce.CeModule; import org.sonar.core.component.DefaultResourceTypes; import org.sonar.core.timemachine.Periods; -import org.sonar.core.user.DefaultUserFinder; -import org.sonar.core.user.DeprecatedUserFinder; import org.sonar.db.permission.PermissionRepository; import org.sonar.server.activity.ActivityService; import org.sonar.server.activity.RubyQProfileActivityService; @@ -278,7 +276,9 @@ import org.sonar.server.ui.ws.GlobalNavigationAction; import org.sonar.server.ui.ws.NavigationWs; import org.sonar.server.ui.ws.SettingsNavigationAction; import org.sonar.server.updatecenter.ws.UpdateCenterWs; +import org.sonar.server.user.DefaultUserFinder; import org.sonar.server.user.DefaultUserService; +import org.sonar.server.user.DeprecatedUserFinder; import org.sonar.server.user.GroupMembershipFinder; import org.sonar.server.user.GroupMembershipService; import org.sonar.server.user.NewUserNotifier; diff --git a/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java b/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserFinder.java index 380124f80aa..83e93033573 100644 --- a/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserFinder.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import com.google.common.collect.Lists; import java.util.Collection; diff --git a/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java b/server/sonar-server/src/main/java/org/sonar/server/user/DeprecatedUserFinder.java index b10733c9225..31a0174d198 100644 --- a/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/DeprecatedUserFinder.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import javax.annotation.Nullable; import org.sonar.api.database.model.User; diff --git a/sonar-db/src/main/java/org/sonar/core/user/GroupMembership.java b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembership.java index 9bd2420ec0a..9c384d1f7af 100644 --- a/sonar-db/src/main/java/org/sonar/core/user/GroupMembership.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembership.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -89,4 +89,5 @@ public class GroupMembership { public int hashCode() { return name.hashCode(); } + } diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java index f6dfe9e4cc8..6dccec36024 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java @@ -21,7 +21,6 @@ package org.sonar.server.user; import java.util.List; import org.sonar.api.server.ServerSide; -import org.sonar.core.user.GroupMembership; import org.sonar.db.user.GroupMembershipDao; import org.sonar.db.user.GroupMembershipDto; import org.sonar.db.user.GroupMembershipQuery; @@ -88,8 +87,12 @@ public class GroupMembershipFinder { private static List<GroupMembership> toGroupMembership(List<GroupMembershipDto> dtos) { List<GroupMembership> groups = newArrayList(); - for (GroupMembershipDto groupMembershipDto : dtos) { - groups.add(groupMembershipDto.toGroupMembership()); + for (GroupMembershipDto dto : dtos) { + groups.add(new GroupMembership() + .setId(dto.getId()) + .setName(dto.getName()) + .setDescription(dto.getDescription()) + .setMember(dto.getUserId() != null)); } return groups; } diff --git a/sonar-db/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserFinderTest.java index 680fd79bb36..e8bdd7d059e 100644 --- a/sonar-db/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserFinderTest.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import java.util.Arrays; import java.util.Collection; diff --git a/sonar-db/src/test/java/org/sonar/core/user/DefaultUserTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserTest.java index 91fe424c3d1..ed7ad739a2f 100644 --- a/sonar-db/src/test/java/org/sonar/core/user/DefaultUserTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserTest.java @@ -17,9 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import org.junit.Test; +import org.sonar.core.user.DefaultUser; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sonar-db/src/test/java/org/sonar/core/user/DeprecatedUserFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/DeprecatedUserFinderTest.java index 427b0473118..02e1419375f 100644 --- a/sonar-db/src/test/java/org/sonar/core/user/DeprecatedUserFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/DeprecatedUserFinderTest.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.core.user; +package org.sonar.server.user; import org.junit.Before; import org.junit.Rule; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java index a786ccf32ae..9a15c64e648 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java @@ -22,7 +22,6 @@ package org.sonar.server.user; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.sonar.core.user.GroupMembership; import org.sonar.db.user.GroupMembershipDao; import org.sonar.db.user.GroupMembershipDto; import org.sonar.db.user.GroupMembershipQuery; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java index c62315399b1..b89c6cc7936 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java @@ -24,7 +24,6 @@ import java.util.List; import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; -import org.sonar.core.user.GroupMembership; import org.sonar.db.DbTester; import org.sonar.server.exceptions.NotFoundException; diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipTest.java index 8441f3f7018..6f5e10a111f 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipTest.java @@ -17,10 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.db.user; +package org.sonar.server.user; import org.junit.Test; -import org.sonar.core.user.GroupMembership; import static org.assertj.core.api.Assertions.assertThat; @@ -49,4 +48,5 @@ public class GroupMembershipTest { .setMember(true); assertThat(group).isEqualTo(group); } + } diff --git a/sonar-db/src/test/resources/org/sonar/core/user/DeprecatedUserFinderTest/fixture.xml b/server/sonar-server/src/test/resources/org/sonar/server/user/DeprecatedUserFinderTest/fixture.xml index 9d370e86a70..9d370e86a70 100644 --- a/sonar-db/src/test/resources/org/sonar/core/user/DeprecatedUserFinderTest/fixture.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/user/DeprecatedUserFinderTest/fixture.xml diff --git a/sonar-db/src/main/java/org/sonar/core/timemachine/Periods.java b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java index 914278a9955..914278a9955 100644 --- a/sonar-db/src/main/java/org/sonar/core/timemachine/Periods.java +++ b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java diff --git a/sonar-db/src/main/java/org/sonar/core/timemachine/package-info.java b/sonar-core/src/main/java/org/sonar/core/timemachine/package-info.java index 7d65a931ce8..7d65a931ce8 100644 --- a/sonar-db/src/main/java/org/sonar/core/timemachine/package-info.java +++ b/sonar-core/src/main/java/org/sonar/core/timemachine/package-info.java diff --git a/sonar-db/src/test/java/org/sonar/core/timemachine/PeriodsTest.java b/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java index 67867b40f7f..67867b40f7f 100644 --- a/sonar-db/src/test/java/org/sonar/core/timemachine/PeriodsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java diff --git a/sonar-db/src/main/java/org/sonar/core/user/package-info.java b/sonar-db/src/main/java/org/sonar/core/user/package-info.java deleted file mode 100644 index 1b87cf81b81..00000000000 --- a/sonar-db/src/main/java/org/sonar/core/user/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@ParametersAreNonnullByDefault -package org.sonar.core.user; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupMembershipDto.java b/sonar-db/src/main/java/org/sonar/db/user/GroupMembershipDto.java index f20b7162f34..517363111d1 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/GroupMembershipDto.java +++ b/sonar-db/src/main/java/org/sonar/db/user/GroupMembershipDto.java @@ -21,7 +21,6 @@ package org.sonar.db.user; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.core.user.GroupMembership; /** * @since 4.1 @@ -71,11 +70,4 @@ public class GroupMembershipDto { return this; } - public GroupMembership toGroupMembership() { - return new GroupMembership() - .setId(id) - .setName(name) - .setDescription(description) - .setMember(userId != null); - } } diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDtoTest.java b/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDtoTest.java deleted file mode 100644 index 6d3e97f3adb..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/user/GroupMembershipDtoTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.db.user; - -import org.junit.Test; -import org.sonar.core.user.GroupMembership; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GroupMembershipDtoTest { - - @Test - public void to_group_with_permission_having_permission() { - GroupMembership group = new GroupMembershipDto() - .setId(1L) - .setName("users") - .setDescription("description") - .setUserId(10L) - .toGroupMembership(); - - assertThat(group.id()).isEqualTo(1); - assertThat(group.name()).isEqualTo("users"); - assertThat(group.description()).isEqualTo("description"); - assertThat(group.isMember()).isTrue(); - } - - @Test - public void to_group_with_permission_not_having_permission() { - GroupMembership group = new GroupMembershipDto() - .setId(1L) - .setName("users") - .setDescription("description") - .setUserId(null) - .toGroupMembership(); - - assertThat(group.id()).isEqualTo(1); - assertThat(group.name()).isEqualTo("users"); - assertThat(group.description()).isEqualTo("description"); - assertThat(group.isMember()).isFalse(); - } - -} |