summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-29 16:40:32 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-30 12:18:13 +0200
commit7c1ed8d45863e2b7622927db78539fd4ce78926b (patch)
tree816ceff6fe69cef8e50eac1a88f0908ca45a9f86
parentd927ef2f4096f3d925f28397aa6edc597b2ce45d (diff)
downloadsonarqube-7c1ed8d45863e2b7622927db78539fd4ce78926b.tar.gz
sonarqube-7c1ed8d45863e2b7622927db78539fd4ce78926b.zip
SONAR-7478 Create UsersWsModule to manage Pico components
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java20
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/ws/UsersWsModule.java42
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsModuleTest.java35
3 files changed, 79 insertions, 18 deletions
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 3bebe3a0f79..e832c4b4d8a 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
@@ -292,12 +292,7 @@ import org.sonar.server.user.UserUpdater;
import org.sonar.server.user.index.UserIndex;
import org.sonar.server.user.index.UserIndexDefinition;
import org.sonar.server.user.index.UserIndexer;
-import org.sonar.server.user.ws.CurrentAction;
-import org.sonar.server.user.ws.FavoritesWs;
-import org.sonar.server.user.ws.IdentityProvidersAction;
-import org.sonar.server.user.ws.UserJsonWriter;
-import org.sonar.server.user.ws.UserPropertiesWs;
-import org.sonar.server.user.ws.UsersWs;
+import org.sonar.server.user.ws.UsersWsModule;
import org.sonar.server.usergroups.ws.UserGroupsModule;
import org.sonar.server.usertoken.UserTokenModule;
import org.sonar.server.util.TypeValidationModule;
@@ -516,22 +511,11 @@ public class PlatformLevel4 extends PlatformLevel {
NewUserNotifier.class,
DefaultUserFinder.class,
DefaultUserService.class,
- UserJsonWriter.class,
- UsersWs.class,
- org.sonar.server.user.ws.CreateAction.class,
- org.sonar.server.user.ws.UpdateAction.class,
- org.sonar.server.user.ws.DeactivateAction.class,
- org.sonar.server.user.ws.ChangePasswordAction.class,
- CurrentAction.class,
- org.sonar.server.user.ws.SearchAction.class,
- org.sonar.server.user.ws.GroupsAction.class,
- IdentityProvidersAction.class,
- FavoritesWs.class,
- UserPropertiesWs.class,
UserIndexDefinition.class,
UserIndexer.class,
UserIndex.class,
UserUpdater.class,
+ UsersWsModule.class,
UserTokenModule.class,
// groups
diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/UsersWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UsersWsModule.java
new file mode 100644
index 00000000000..2b8e05dc785
--- /dev/null
+++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UsersWsModule.java
@@ -0,0 +1,42 @@
+/*
+ * 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.server.user.ws;
+
+import org.sonar.core.platform.Module;
+
+public class UsersWsModule extends Module {
+ @Override
+ protected void configureModule() {
+ add(
+ UsersWs.class,
+ CreateAction.class,
+ UpdateAction.class,
+ DeactivateAction.class,
+ ChangePasswordAction.class,
+ CurrentAction.class,
+ SearchAction.class,
+ GroupsAction.class,
+ IdentityProvidersAction.class,
+ FavoritesWs.class,
+ UserPropertiesWs.class,
+ UserJsonWriter.class);
+ }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsModuleTest.java
new file mode 100644
index 00000000000..acf5f1c6fdb
--- /dev/null
+++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsModuleTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.server.user.ws;
+
+import org.junit.Test;
+import org.sonar.core.platform.ComponentContainer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class UsersWsModuleTest {
+ @Test
+ public void verify_count_of_added_components() {
+ ComponentContainer container = new ComponentContainer();
+ new UsersWsModule().configure(container);
+ assertThat(container.size()).isEqualTo(2 + 12);
+ }
+}