]> source.dussan.org Git - sonarqube.git/commitdiff
add MetricsWsModule 343/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 2 Jun 2015 12:14:25 +0000 (14:14 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 2 Jun 2015 12:15:02 +0000 (14:15 +0200)
server/sonar-server/src/main/java/org/sonar/server/metric/ws/MetricsWsModule.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsModuleTest.java [new file with mode: 0644]

diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/MetricsWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/MetricsWsModule.java
new file mode 100644 (file)
index 0000000..4ac2423
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.metric.ws;
+
+import org.sonar.core.component.Module;
+
+public class MetricsWsModule extends Module {
+  @Override
+  protected void configureModule() {
+    add(
+      MetricsWs.class,
+      CreateAction.class,
+      DeleteAction.class,
+      DomainsAction.class,
+      SearchAction.class,
+      TypesAction.class);
+  }
+}
index 73972ef1ed7ff39475a2216722a626a2a2781023..c8b5f7398995e8f6c8b9fae5c05cc5934613d79d 100644 (file)
@@ -169,8 +169,7 @@ import org.sonar.server.measure.template.ProjectFilter;
 import org.sonar.server.measure.ws.ManualMeasuresWs;
 import org.sonar.server.measure.ws.TimeMachineWs;
 import org.sonar.server.metric.CoreCustomMetrics;
-import org.sonar.server.metric.ws.MetricsWs;
-import org.sonar.server.metric.ws.SearchAction;
+import org.sonar.server.metric.ws.MetricsWsModule;
 import org.sonar.server.notifications.NotificationCenter;
 import org.sonar.server.notifications.NotificationService;
 import org.sonar.server.permission.InternalPermissionService;
@@ -494,13 +493,8 @@ public class PlatformLevel4 extends PlatformLevel {
       DefaultMetricFinder.class,
       TimeMachineWs.class,
       ManualMeasuresWs.class,
-      MetricsWs.class,
-      SearchAction.class,
-      org.sonar.server.metric.ws.TypesAction.class,
-      org.sonar.server.metric.ws.DomainsAction.class,
-      org.sonar.server.metric.ws.DeleteAction.class,
-      org.sonar.server.metric.ws.CreateAction.class,
 
+      MetricsWsModule.class,
 
       // quality gates
       QualityGateDao.class,
diff --git a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsModuleTest.java
new file mode 100644 (file)
index 0000000..fba9466
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.metric.ws;
+
+import org.junit.Test;
+import org.sonar.core.platform.ComponentContainer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MetricsWsModuleTest {
+  @Test
+  public void verify_count_of_added_components() {
+    ComponentContainer container = new ComponentContainer();
+    new MetricsWsModule().configure(container);
+    assertThat(container.size()).isEqualTo(8);
+  }
+}