*/
package org.sonar.server.platform.platformlevel;
+import java.util.Properties;
+import javax.annotation.Nullable;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.internal.TempFolderCleaner;
import org.sonar.core.config.CorePropertyDefinitions;
import org.sonar.server.db.DbClient;
import org.sonar.server.db.EmbeddedDatabaseFactory;
import org.sonar.server.db.migrations.MigrationSteps;
-import org.sonar.server.es.EsClient;
import org.sonar.server.event.db.EventDao;
import org.sonar.server.issue.db.IssueDao;
import org.sonar.server.issue.index.IssueIndex;
import org.sonar.server.rule.db.RuleDao;
import org.sonar.server.rule.index.RuleIndex;
import org.sonar.server.rule.index.RuleNormalizer;
-import org.sonar.server.search.IndexClient;
+import org.sonar.server.search.EsSearchModule;
import org.sonar.server.search.IndexQueue;
-import org.sonar.server.search.SearchClient;
import org.sonar.server.source.db.FileSourceDao;
import org.sonar.server.user.ThreadLocalUserSession;
import org.sonar.server.user.db.GroupDao;
import org.sonar.server.user.db.UserDao;
import org.sonar.server.user.db.UserGroupDao;
-import javax.annotation.Nullable;
-
-import java.util.Properties;
-
public class PlatformLevel1 extends PlatformLevel {
private final Platform platform;
private final Properties properties;
DbClient.class,
// Elasticsearch
- SearchClient.class,
- IndexClient.class,
- EsClient.class,
+ EsSearchModule.class,
// users
GroupDao.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.search;
+
+import org.sonar.core.component.Module;
+import org.sonar.server.es.EsClient;
+
+public class EsSearchModule extends Module {
+ @Override
+ protected void configureModule() {
+ add(
+ SearchClient.class,
+ IndexClient.class,
+ EsClient.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.search;
+
+import org.junit.Test;
+import org.sonar.core.platform.ComponentContainer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class EsSearchModuleTest {
+ @Test
+ public void verify_count_of_added_components() throws Exception {
+ ComponentContainer container = new ComponentContainer();
+ new EsSearchModule().configure(container);
+ assertThat(container.size()).isEqualTo(5);
+ }
+
+}
public MutablePicoContainer getPicoContainer() {
return pico;
}
+
+ public int size() {
+ return pico.getComponentAdapters().size();
+ }
}