--- /dev/null
+/*
+ * 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.batch;
+
+import org.sonar.core.component.Module;
+import org.sonar.server.computation.ws.SubmitReportAction;
+
+public class BatchWsModule extends Module {
+ @Override
+ protected void configureModule() {
+ add(
+ BatchIndex.class,
+ GlobalAction.class,
+ ProjectAction.class,
+ ProjectRepositoryLoader.class,
+ SubmitReportAction.class,
+ IssuesAction.class,
+ UsersAction.class,
+ BatchWs.class);
+ }
+}
import org.sonar.server.activity.ws.ActivitiesWs;
import org.sonar.server.activity.ws.ActivityMapping;
import org.sonar.server.authentication.ws.AuthenticationWs;
-import org.sonar.server.batch.BatchIndex;
-import org.sonar.server.batch.BatchWs;
-import org.sonar.server.batch.GlobalAction;
-import org.sonar.server.batch.IssuesAction;
-import org.sonar.server.batch.ProjectAction;
-import org.sonar.server.batch.ProjectRepositoryLoader;
-import org.sonar.server.batch.UsersAction;
+import org.sonar.server.batch.BatchWsModule;
import org.sonar.server.charts.ChartFactory;
import org.sonar.server.component.ComponentCleanerService;
import org.sonar.server.component.ComponentService;
import org.sonar.server.computation.ws.HistoryAction;
import org.sonar.server.computation.ws.IsQueueEmptyWs;
import org.sonar.server.computation.ws.QueueAction;
-import org.sonar.server.computation.ws.SubmitReportAction;
import org.sonar.server.config.ws.PropertiesWs;
import org.sonar.server.dashboard.ws.DashboardsWs;
import org.sonar.server.debt.DebtCharacteristicsXMLImporter;
ActivityIndex.class,
// batch
- BatchIndex.class,
- GlobalAction.class,
- ProjectAction.class,
- ProjectRepositoryLoader.class,
- SubmitReportAction.class,
- IssuesAction.class,
- UsersAction.class,
- BatchWs.class,
+ BatchWsModule.class,
// Dashboard
DashboardsWs.class,
--- /dev/null
+/*
+ * 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.batch;
+
+import org.junit.Test;
+import org.sonar.core.platform.ComponentContainer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class BatchWsModuleTest {
+ @Test
+ public void verify_count_of_added_components() throws Exception {
+ ComponentContainer container = new ComponentContainer();
+ new BatchWsModule().configure(container);
+ assertThat(container.size()).isEqualTo(10);
+ }
+
+}
*/
package org.sonar.core.component;
-import java.util.Collection;
-import javax.annotation.Nullable;
import org.sonar.core.platform.ComponentContainer;
import static com.google.common.base.Preconditions.checkNotNull;
protected abstract void configureModule();
- protected void add(@Nullable Object object, boolean singleton) {
- if (object != null) {
- container.addComponent(object, singleton);
- }
- }
-
protected <T> T getComponentByType(Class<T> tClass) {
return container.getComponentByType(tClass);
}
}
}
- protected void addAll(Collection<?> objects) {
- add(objects.toArray(new Object[objects.size()]));
- }
-
}