]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7478 Create UsersWsModule to manage Pico components 877/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 29 Mar 2016 14:40:32 +0000 (16:40 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 30 Mar 2016 10:18:13 +0000 (12:18 +0200)
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/UsersWsModule.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsModuleTest.java [new file with mode: 0644]

index 3bebe3a0f7923589e57efcc0c6e26267e683d47f..e832c4b4d8a3fa34e29bbc9092a0105b98d43e8b 100644 (file)
@@ -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 (file)
index 0000000..2b8e05d
--- /dev/null
@@ -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 (file)
index 0000000..acf5f1c
--- /dev/null
@@ -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);
+  }
+}