aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/pom.xml1
-rw-r--r--server/sonar-search/pom.xml60
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/EsSettings.java184
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/EsSettingsMBean.java38
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java50
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/package-info.java23
-rw-r--r--server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java188
-rw-r--r--server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java166
-rw-r--r--server/sonar-search/src/test/resources/logback-test.xml38
-rw-r--r--server/sonar-search/src/test/resources/search.properties0
-rw-r--r--server/sonar-server/pom.xml6
-rw-r--r--sonar-application/assembly.xml11
-rw-r--r--sonar-application/pom.xml10
13 files changed, 2 insertions, 773 deletions
diff --git a/server/pom.xml b/server/pom.xml
index 0666069e540..6ecf0057406 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -15,7 +15,6 @@
<modules>
<module>sonar-process</module>
<module>sonar-process-monitor</module>
- <module>sonar-search</module>
<module>sonar-db-core</module>
<module>sonar-db-migration</module>
<module>sonar-db-dao</module>
diff --git a/server/sonar-search/pom.xml b/server/sonar-search/pom.xml
deleted file mode 100644
index be0708536e8..00000000000
--- a/server/sonar-search/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.sonarsource.sonarqube</groupId>
- <artifactId>server</artifactId>
- <version>6.6-SNAPSHOT</version>
- <relativePath>../</relativePath>
- </parent>
-
- <artifactId>sonar-search</artifactId>
- <packaging>jar</packaging>
- <name>SonarQube :: Search</name>
- <description>Wrapper to start Elasticsearch</description>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-process</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java b/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
deleted file mode 100644
index 4df00c79311..00000000000
--- a/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.search;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.process.ProcessProperties;
-import org.sonar.process.Props;
-
-public class EsSettings implements EsSettingsMBean {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(EsSettings.class);
- public static final String PROP_MARVEL_HOSTS = "sonar.search.marvelHosts";
- public static final String CLUSTER_SEARCH_NODE_NAME = "sonar.cluster.search.nodeName";
- public static final String STANDALONE_NODE_NAME = "sonarqube";
-
- private final Props props;
-
- private final boolean clusterEnabled;
- private final String clusterName;
- private final String nodeName;
-
- EsSettings(Props props) {
- this.props = props;
-
- this.clusterName = props.nonNullValue(ProcessProperties.CLUSTER_NAME);
- this.clusterEnabled = props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED);
- if (this.clusterEnabled) {
- this.nodeName = props.value(CLUSTER_SEARCH_NODE_NAME, "sonarqube-" + UUID.randomUUID().toString());
- } else {
- this.nodeName = STANDALONE_NODE_NAME;
- }
- }
-
- @Override
- public int getHttpPort() {
- return props.valueAsInt(ProcessProperties.SEARCH_HTTP_PORT, -1);
- }
-
- @Override
- public String getClusterName() {
- return clusterName;
- }
-
- @Override
- public String getNodeName() {
- return nodeName;
- }
-
- Map<String, String> build() {
- Map<String, String> builder = new HashMap<>();
- configureFileSystem(builder);
- configureNetwork(builder);
- configureCluster(builder);
- configureMarvel(builder);
- return builder;
- }
-
- private void configureFileSystem(Map<String, String> builder) {
- File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
- File dataDir;
- File logDir;
-
- // data dir
- String dataPath = props.value(ProcessProperties.PATH_DATA);
- if (StringUtils.isNotEmpty(dataPath)) {
- dataDir = new File(dataPath, "es");
- } else {
- dataDir = new File(homeDir, "data/es");
- }
- builder.put("path.data", dataDir.getAbsolutePath());
-
- String tempPath = props.value(ProcessProperties.PATH_TEMP);
- builder.put("path.home", new File(tempPath, "es").getAbsolutePath());
-
- // log dir
- String logPath = props.value(ProcessProperties.PATH_LOGS);
- if (StringUtils.isNotEmpty(logPath)) {
- logDir = new File(logPath);
- } else {
- logDir = new File(homeDir, "log");
- }
- builder.put("path.logs", logDir.getAbsolutePath());
- }
-
- private void configureNetwork(Map<String, String> builder) {
- InetAddress host = readHost();
- int port = Integer.parseInt(props.nonNullValue(ProcessProperties.SEARCH_PORT));
- LOGGER.info("Elasticsearch listening on {}:{}", host, port);
-
- builder.put("transport.tcp.port", String.valueOf(port));
- builder.put("transport.host", String.valueOf(host.getHostAddress()));
- builder.put("network.host", String.valueOf(host.getHostAddress()));
-
- // Elasticsearch sets the default value of TCP reuse address to true only on non-MSWindows machines, but why ?
- builder.put("network.tcp.reuse_address", String.valueOf(true));
-
- int httpPort = getHttpPort();
- if (httpPort < 0) {
- // standard configuration
- builder.put("http.enabled", String.valueOf(false));
- } else {
- LOGGER.warn("Elasticsearch HTTP connector is enabled on port {}. MUST NOT BE USED FOR PRODUCTION", httpPort);
- // see https://github.com/lmenezes/elasticsearch-kopf/issues/195
- builder.put("http.cors.enabled", String.valueOf(true));
- builder.put("http.cors.allow-origin", "*");
- builder.put("http.enabled", String.valueOf(true));
- builder.put("http.host", host.getHostAddress());
- builder.put("http.port", String.valueOf(httpPort));
- }
- }
-
- private InetAddress readHost() {
- String hostProperty = props.nonNullValue(ProcessProperties.SEARCH_HOST);
- try {
- return InetAddress.getByName(hostProperty);
- } catch (UnknownHostException e) {
- throw new IllegalStateException("Can not resolve host [" + hostProperty + "]. Please check network settings and property " + ProcessProperties.SEARCH_HOST, e);
- }
- }
-
- private void configureCluster(Map<String, String> builder) {
- // Default value in a standalone mode, not overridable
- int minimumMasterNodes = 1;
- String initialStateTimeOut = "30s";
-
- if (clusterEnabled) {
- minimumMasterNodes = props.valueAsInt(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, 2);
- initialStateTimeOut = props.value(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "120s");
-
- String hosts = props.value(ProcessProperties.CLUSTER_SEARCH_HOSTS, "");
- LOGGER.info("Elasticsearch cluster enabled. Connect to hosts [{}]", hosts);
- builder.put("discovery.zen.ping.unicast.hosts", hosts);
- }
-
- builder.put("discovery.zen.minimum_master_nodes", String.valueOf(minimumMasterNodes));
- builder.put("discovery.initial_state_timeout", initialStateTimeOut);
- builder.put("cluster.name", getClusterName());
- builder.put("cluster.routing.allocation.awareness.attributes", "rack_id");
- builder.put("node.attr.rack_id", nodeName);
- builder.put("node.name", nodeName);
- builder.put("node.data", String.valueOf(true));
- builder.put("node.master", String.valueOf(true));
- }
-
- private void configureMarvel(Map<String, String> builder) {
- Set<String> marvels = new TreeSet<>();
- marvels.addAll(Arrays.asList(StringUtils.split(props.value(PROP_MARVEL_HOSTS, ""), ",")));
-
- // If we're collecting indexing data send them to the Marvel host(s)
- if (!marvels.isEmpty()) {
- String hosts = StringUtils.join(marvels, ",");
- LOGGER.info("Elasticsearch Marvel is enabled for %s", hosts);
- builder.put("marvel.agent.exporter.es.hosts", hosts);
- }
- }
-}
diff --git a/server/sonar-search/src/main/java/org/sonar/search/EsSettingsMBean.java b/server/sonar-search/src/main/java/org/sonar/search/EsSettingsMBean.java
deleted file mode 100644
index 58774b246fa..00000000000
--- a/server/sonar-search/src/main/java/org/sonar/search/EsSettingsMBean.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.search;
-
-/**
- * MBean registered in the Elasticsearch process
- */
-public interface EsSettingsMBean {
-
- String OBJECT_NAME = "SonarQube:name=ElasticsearchSettings";
-
- /**
- * @return the enabled HTTP port, -1 if disabled
- */
- int getHttpPort();
-
- String getClusterName();
-
- String getNodeName();
-
-}
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java b/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java
deleted file mode 100644
index adeab47a2d2..00000000000
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.search;
-
-import ch.qos.logback.classic.LoggerContext;
-import org.sonar.process.logging.LogLevelConfig;
-import org.sonar.process.logging.LogbackHelper;
-import org.sonar.process.ProcessId;
-import org.sonar.process.Props;
-import org.sonar.process.logging.RootLoggerConfig;
-
-import static org.sonar.process.logging.RootLoggerConfig.newRootLoggerConfigBuilder;
-
-public class SearchLogging {
-
- private LogbackHelper helper = new LogbackHelper();
-
- public LoggerContext configure(Props props) {
- LoggerContext ctx = helper.getRootContext();
- ctx.reset();
-
- RootLoggerConfig config = newRootLoggerConfigBuilder().setProcessId(ProcessId.ELASTICSEARCH).build();
-
- String logPattern = helper.buildLogPattern(config);
- helper.configureGlobalFileLog(props, config, logPattern);
- helper.configureForSubprocessGobbler(props, logPattern);
-
- helper.apply(LogLevelConfig.newBuilder(helper.getRootLoggerName()).rootLevelFor(ProcessId.ELASTICSEARCH).build(), props);
-
- return ctx;
- }
-
-}
diff --git a/server/sonar-search/src/main/java/org/sonar/search/package-info.java b/server/sonar-search/src/main/java/org/sonar/search/package-info.java
deleted file mode 100644
index 0164ade85ba..00000000000
--- a/server/sonar-search/src/main/java/org/sonar/search/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.search;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java b/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java
deleted file mode 100644
index 3282bac78de..00000000000
--- a/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.search;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.process.ProcessProperties;
-import org.sonar.process.Props;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class EsSettingsTest {
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Test
- public void test_default_settings() throws Exception {
- File homeDir = temp.newFolder();
- Props props = new Props(new Properties());
- props.set(ProcessProperties.SEARCH_PORT, "1234");
- props.set(ProcessProperties.SEARCH_HOST, "127.0.0.1");
- props.set(ProcessProperties.PATH_HOME, homeDir.getAbsolutePath());
- props.set(ProcessProperties.CLUSTER_NAME, "sonarqube");
-
- EsSettings esSettings = new EsSettings(props);
-
- Map<String, String> generated = esSettings.build();
- assertThat(generated.get("transport.tcp.port")).isEqualTo("1234");
- assertThat(generated.get("transport.host")).isEqualTo("127.0.0.1");
-
- // no cluster, but cluster and node names are set though
- assertThat(generated.get("cluster.name")).isEqualTo("sonarqube");
- assertThat(generated.get("node.name")).isEqualTo("sonarqube");
-
- assertThat(generated.get("path.data")).isNotNull();
- assertThat(generated.get("path.logs")).isNotNull();
- assertThat(generated.get("path.home")).isNotNull();
-
- // http is disabled for security reasons
- assertThat(generated.get("http.enabled")).isEqualTo("false");
-
- assertThat(generated.get("discovery.zen.ping.unicast.hosts")).isNull();
- assertThat(generated.get("discovery.zen.minimum_master_nodes")).isEqualTo("1");
- assertThat(generated.get("discovery.initial_state_timeout")).isEqualTo("30s");
- }
-
- @Test
- public void override_dirs() throws Exception {
- File dataDir = temp.newFolder();
- File logDir = temp.newFolder();
- File tempDir = temp.newFolder();
- Props props = minProps(false);
- props.set(ProcessProperties.PATH_DATA, dataDir.getAbsolutePath());
- props.set(ProcessProperties.PATH_LOGS, logDir.getAbsolutePath());
- props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
-
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("path.data")).isEqualTo(new File(dataDir, "es").getAbsolutePath());
- assertThat(settings.get("path.logs")).isEqualTo(logDir.getAbsolutePath());
- assertThat(settings.get("path.home")).isEqualTo(new File(tempDir, "es").getAbsolutePath());
- }
-
- @Test
- public void cluster_is_enabled() throws Exception {
- Props props = minProps(true);
- props.set(ProcessProperties.CLUSTER_SEARCH_HOSTS, "1.2.3.4:9000,1.2.3.5:8080");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isEqualTo("1.2.3.4:9000,1.2.3.5:8080");
- assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("2");
- assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("120s");
- }
-
- @Test
- public void incorrect_values_of_minimum_master_nodes() throws Exception {
- Props props = minProps(true);
- props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "ꝱꝲꝳପ");
-
- expectedException.expect(IllegalStateException.class);
- expectedException.expectMessage("Value of property sonar.search.minimumMasterNodes is not an integer:");
- Map<String, String> settings = new EsSettings(props).build();
- }
-
- @Test
- public void cluster_is_enabled_with_defined_minimum_master_nodes() throws Exception {
- Props props = minProps(true);
- props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("5");
- }
-
- @Test
- public void cluster_is_enabled_with_defined_initialTimeout() throws Exception {
- Props props = minProps(true);
- props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("10s");
- }
-
- @Test
- public void in_standalone_initialTimeout_is_not_overridable() throws Exception {
- Props props = minProps(false);
- props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("30s");
- }
-
- @Test
- public void in_standalone_minimumMasterNodes_is_not_overridable() throws Exception {
- Props props = minProps(false);
- props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("1");
- }
-
- @Test
- public void enable_marvel() throws Exception {
- Props props = minProps(false);
- props.set(EsSettings.PROP_MARVEL_HOSTS, "127.0.0.2,127.0.0.3");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
- }
-
- @Test
- public void enable_http_connector() throws Exception {
- Props props = minProps(false);
- props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("http.port")).isEqualTo("9010");
- assertThat(settings.get("http.host")).isEqualTo("127.0.0.1");
- assertThat(settings.get("http.enabled")).isEqualTo("true");
- }
-
- @Test
- public void enable_http_connector_different_host() throws Exception {
- Props props = minProps(false);
- props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
- props.set(ProcessProperties.SEARCH_HOST, "127.0.0.2");
- Map<String, String> settings = new EsSettings(props).build();
-
- assertThat(settings.get("http.port")).isEqualTo("9010");
- assertThat(settings.get("http.host")).isEqualTo("127.0.0.2");
- assertThat(settings.get("http.enabled")).isEqualTo("true");
- }
-
- private Props minProps(boolean cluster) throws IOException {
- File homeDir = temp.newFolder();
- Props props = new Props(new Properties());
- ProcessProperties.completeDefaults(props);
- props.set(ProcessProperties.PATH_HOME, homeDir.getAbsolutePath());
- props.set(ProcessProperties.CLUSTER_ENABLED, Boolean.toString(cluster));
- return props;
- }
-}
diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java
deleted file mode 100644
index 2689b34ece4..00000000000
--- a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.search;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.FileAppender;
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.process.logging.LogbackHelper;
-import org.sonar.process.ProcessProperties;
-import org.sonar.process.Props;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.slf4j.Logger.ROOT_LOGGER_NAME;
-
-public class SearchLoggingTest {
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private File logDir;
-
- private Props props = new Props(new Properties());
- private SearchLogging underTest = new SearchLogging();
-
- @Before
- public void setUp() throws IOException {
- logDir = temp.newFolder();
- props.set(ProcessProperties.PATH_LOGS, logDir.getAbsolutePath());
- }
-
- @AfterClass
- public static void resetLogback() throws Exception {
- new LogbackHelper().resetFromXml("/logback-test.xml");
- }
-
- @Test
- public void do_not_log_to_console() {
- LoggerContext ctx = underTest.configure(props);
-
- Logger root = ctx.getLogger(ROOT_LOGGER_NAME);
- Appender appender = root.getAppender("CONSOLE");
- assertThat(appender).isNull();
- }
-
- @Test
- public void log_to_es_file() {
- LoggerContext ctx = underTest.configure(props);
-
- Logger root = ctx.getLogger(ROOT_LOGGER_NAME);
- Appender<ILoggingEvent> appender = root.getAppender("file_es");
- assertThat(appender).isInstanceOf(FileAppender.class);
- FileAppender fileAppender = (FileAppender) appender;
- assertThat(fileAppender.getFile()).isEqualTo(new File(logDir, "es.log").getAbsolutePath());
- assertThat(fileAppender.getEncoder()).isInstanceOf(PatternLayoutEncoder.class);
- PatternLayoutEncoder encoder = (PatternLayoutEncoder) fileAppender.getEncoder();
- assertThat(encoder.getPattern()).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{20}] %msg%n");
- }
-
- @Test
- public void default_level_for_root_logger_is_INFO() {
- LoggerContext ctx = underTest.configure(props);
-
- verifyRootLogLevel(ctx, Level.INFO);
- }
-
- @Test
- public void root_logger_level_changes_with_global_property() {
- props.set("sonar.log.level", "TRACE");
-
- LoggerContext ctx = underTest.configure(props);
-
- verifyRootLogLevel(ctx, Level.TRACE);
- }
-
- @Test
- public void root_logger_level_changes_with_es_property() {
- props.set("sonar.log.level.es", "TRACE");
-
- LoggerContext ctx = underTest.configure(props);
-
- verifyRootLogLevel(ctx, Level.TRACE);
- }
-
- @Test
- public void root_logger_level_is_configured_from_es_property_over_global_property() {
- props.set("sonar.log.level", "TRACE");
- props.set("sonar.log.level.es", "DEBUG");
-
- LoggerContext ctx = underTest.configure(props);
-
- verifyRootLogLevel(ctx, Level.DEBUG);
- }
-
- @Test
- public void root_logger_level_changes_with_es_property_and_is_case_insensitive() {
- props.set("sonar.log.level.es", "deBug");
-
- LoggerContext ctx = underTest.configure(props);
-
- verifyRootLogLevel(ctx, Level.DEBUG);
- }
-
- @Test
- public void root_logger_level_defaults_to_INFO_if_es_property_has_invalid_value() {
- props.set("sonar.log.level.es", "DodoDouh!");
-
- LoggerContext ctx = underTest.configure(props);
- verifyRootLogLevel(ctx, Level.INFO);
- }
-
- @Test
- public void fail_with_IAE_if_global_property_unsupported_level() {
- props.set("sonar.log.level", "ERROR");
-
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("log level ERROR in property sonar.log.level is not a supported value (allowed levels are [TRACE, DEBUG, INFO])");
-
- underTest.configure(props);
- }
-
- @Test
- public void fail_with_IAE_if_es_property_unsupported_level() {
- props.set("sonar.log.level.es", "ERROR");
-
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("log level ERROR in property sonar.log.level.es is not a supported value (allowed levels are [TRACE, DEBUG, INFO])");
-
- underTest.configure(props);
- }
-
- private void verifyRootLogLevel(LoggerContext ctx, Level expected) {
- Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
- assertThat(rootLogger.getLevel()).isEqualTo(expected);
- }
-}
diff --git a/server/sonar-search/src/test/resources/logback-test.xml b/server/sonar-search/src/test/resources/logback-test.xml
deleted file mode 100644
index df0bb26d407..00000000000
--- a/server/sonar-search/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--
- Configuration for default logger. Only used while embedded server is starting,
- before proper logging configuration is loaded.
-
- See http://logback.qos.ch/manual/configuration.html
--->
-<configuration debug="false">
- <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
-
- <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>INFO</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>
- %d{yyyy.MM.dd HH:mm:ss} %-5level %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>
- %d{yyyy.MM.dd HH:mm:ss} %-5level %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="INFO"/>
- <appender-ref ref="CONSOLE"/>
- </root>
-
-</configuration>
diff --git a/server/sonar-search/src/test/resources/search.properties b/server/sonar-search/src/test/resources/search.properties
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/server/sonar-search/src/test/resources/search.properties
+++ /dev/null
diff --git a/server/sonar-server/pom.xml b/server/sonar-server/pom.xml
index f2400aa3a7d..f911d3831e8 100644
--- a/server/sonar-server/pom.xml
+++ b/server/sonar-server/pom.xml
@@ -244,12 +244,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-search</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<scope>test</scope>
diff --git a/sonar-application/assembly.xml b/sonar-application/assembly.xml
index 1ac8ca73978..5d5e0b47947 100644
--- a/sonar-application/assembly.xml
+++ b/sonar-application/assembly.xml
@@ -37,17 +37,6 @@
</dependencySet>
<dependencySet>
- <outputDirectory>lib/search</outputDirectory>
- <useProjectArtifact>false</useProjectArtifact>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <useTransitiveFiltering>false</useTransitiveFiltering>
- <includes>
- <include>org.sonarsource.sonarqube:sonar-search</include>
- </includes>
- <scope>provided</scope>
- </dependencySet>
-
- <dependencySet>
<outputDirectory>lib/server</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index 465de1fe104..0baa854c572 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -51,12 +51,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>sonar-search</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>sonar-ce</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -260,8 +254,8 @@
<configuration>
<rules>
<requireFilesSize>
- <minsize>202000000</minsize>
- <maxsize>210000000</maxsize>
+ <minsize>190000000</minsize>
+ <maxsize>205000000</maxsize>
<files>
<file>${project.build.directory}/sonarqube-${project.version}.zip</file>
</files>