import org.sonar.process.command.AbstractCommand;
import org.sonar.process.command.EsCommand;
import org.sonar.process.command.JavaCommand;
+import org.sonar.process.es.EsFileSystem;
import org.sonar.process.jmvoptions.JvmOptions;
import org.sonar.process.sharedmemoryfile.AllProcessesCommands;
import org.sonar.process.sharedmemoryfile.ProcessCommands;
}
private void writeConfFiles(EsCommand esCommand) {
- File confDir = esCommand.getConfDir();
+ EsFileSystem esFileSystem = esCommand.getFileSystem();
+ File confDir = esFileSystem.getConfDirectory();
if (!confDir.exists() && !confDir.mkdirs()) {
String error = format("Failed to create temporary configuration directory [%s]", confDir.getAbsolutePath());
LOG.error(error);
}
try {
- IOUtils.copy(getClass().getResourceAsStream("elasticsearch.yml"), new FileOutputStream(new File(confDir, "elasticsearch.yml")));
- esCommand.getEsJvmOptions().writeToJvmOptionFile(new File(confDir, "jvm.options"));
- esCommand.getLog4j2Properties().store(new FileOutputStream(new File(confDir, "log4j2.properties")), "log42 properties file for ES bundled in SonarQube");
+ IOUtils.copy(getClass().getResourceAsStream("elasticsearch.yml"), new FileOutputStream(esFileSystem.getElasticsearchYml()));
+ esCommand.getEsJvmOptions().writeToJvmOptionFile(esFileSystem.getJvmOptions());
+ esCommand.getLog4j2Properties().store(new FileOutputStream(esFileSystem.getLog4j2Properties()), "log4j2 properties file for ES bundled in SonarQube");
} catch (IOException e) {
throw new IllegalStateException("Failed to write ES configuration files", e);
}
private ProcessBuilder create(EsCommand esCommand) {
List<String> commands = new ArrayList<>();
- commands.add(esCommand.getExecutable().getAbsolutePath());
+ commands.add(esCommand.getFileSystem().getExecutable().getAbsolutePath());
commands.addAll(esCommand.getEsOptions());
return create(esCommand, commands);
import org.sonar.process.ProcessId;
import org.sonar.process.ProcessProperties;
import org.sonar.process.Props;
+import org.sonar.process.es.EsFileSystem;
import org.sonar.process.es.EsLogging;
import org.sonar.process.es.EsSettings;
import org.sonar.process.jmvoptions.CeJvmOptions;
@Override
public EsCommand createEsCommand() {
- File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
- File executable = new File(homeDir, getExecutable());
- if (!executable.exists()) {
+ EsFileSystem esFileSystem = new EsFileSystem(props);
+ if (!esFileSystem.getExecutable().exists()) {
throw new IllegalStateException("Cannot find elasticsearch binary");
}
+ Map<String, String> settingsMap = new EsSettings(props, esFileSystem).build();
- Map<String, String> settingsMap = new EsSettings(props).build();
-
- File logDir = new File(settingsMap.get("path.logs"));
- File confDir = new File(settingsMap.get("path.conf"));
- EsCommand res = new EsCommand(ProcessId.ELASTICSEARCH, executable.getParentFile().getParentFile())
- .setExecutable(executable)
- .setConfDir(confDir)
- .setLog4j2Properties(new EsLogging().createProperties(props, logDir))
+ EsCommand res = new EsCommand(ProcessId.ELASTICSEARCH, esFileSystem.getHomeDirectory())
+ .setFileSystem(esFileSystem)
+ .setLog4j2Properties(new EsLogging().createProperties(props, esFileSystem.getLogDirectory()))
.setArguments(props.rawProperties())
.setClusterName(settingsMap.get("cluster.name"))
.setHost(settingsMap.get("network.host"))
return res;
}
- private static String getExecutable() {
- if (System.getProperty("os.name").startsWith("Windows")) {
- return "elasticsearch/bin/elasticsearch.bat";
- }
- return "elasticsearch/bin/elasticsearch";
- }
-
@Override
public JavaCommand createWebCommand(boolean leader) {
File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
import java.util.List;
import java.util.Properties;
import org.sonar.process.ProcessId;
+import org.sonar.process.es.EsFileSystem;
import org.sonar.process.jmvoptions.EsJvmOptions;
public class EsCommand extends AbstractCommand<EsCommand> {
- private File executable;
- private File confDir;
+ private EsFileSystem fileSystem;
private String clusterName;
private String host;
private int port;
super(id, workDir);
}
- public File getExecutable() {
- return executable;
+ public EsFileSystem getFileSystem() {
+ return fileSystem;
}
- public EsCommand setExecutable(File executable) {
- this.executable = executable;
- return this;
- }
-
- public File getConfDir() {
- return confDir;
- }
-
- public EsCommand setConfDir(File confDir) {
- this.confDir = confDir;
+ public EsCommand setFileSystem(EsFileSystem fileSystem) {
+ this.fileSystem = fileSystem;
return this;
}
--- /dev/null
+/*
+ * 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.process.es;
+
+import java.io.File;
+import org.apache.commons.lang.StringUtils;
+import org.sonar.process.ProcessProperties;
+import org.sonar.process.Props;
+
+/**
+ * Holds {@link File} to the various directories of ElasticSearch distribution embedded in SonarQube and provides
+ * {@link File} objects to the various files of it SonarQube cares about.
+ *
+ * <p>
+ * This class does not ensure files nor directories actually exist.
+ * </p>
+ */
+public class EsFileSystem {
+ private final File homeDirectory;
+ private final File dataDirectory;
+ private final File confDirectory;
+ private final File logDirectory;
+
+ public EsFileSystem(Props props) {
+ File sqHomeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
+
+ this.homeDirectory = new File(sqHomeDir, "elasticsearch");
+ this.dataDirectory = buildDataDir(props, sqHomeDir);
+ this.confDirectory = buildConfDir(props);
+ this.logDirectory = buildLogPath(props, sqHomeDir);
+ }
+
+ private static File buildDataDir(Props props, File sqHomeDir) {
+ String dataPath = props.value(ProcessProperties.PATH_DATA);
+ if (StringUtils.isNotEmpty(dataPath)) {
+ return new File(dataPath, "es");
+ }
+ return new File(sqHomeDir, "data/es");
+ }
+
+ private static File buildLogPath(Props props, File sqHomeDir) {
+ String logPath = props.value(ProcessProperties.PATH_LOGS);
+ if (StringUtils.isNotEmpty(logPath)) {
+ return new File(logPath);
+ }
+ return new File(sqHomeDir, "log");
+ }
+
+ private static File buildConfDir(Props props) {
+ File tempPath = props.nonNullValueAsFile(ProcessProperties.PATH_TEMP);
+ return new File(new File(tempPath, "conf"), "es");
+ }
+
+ public File getHomeDirectory() {
+ return homeDirectory;
+ }
+
+ public File getDataDirectory() {
+ return dataDirectory;
+ }
+
+ public File getConfDirectory() {
+ return confDirectory;
+ }
+
+ public File getLogDirectory() {
+ return logDirectory;
+ }
+
+ public File getExecutable() {
+ return new File(homeDirectory, "bin/" + getExecutableName());
+ }
+
+ private static String getExecutableName() {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ return "elasticsearch.bat";
+ }
+ return "elasticsearch";
+ }
+
+ public File getLog4j2Properties() {
+ return new File(confDirectory, "log4j2.properties");
+ }
+
+ public File getElasticsearchYml() {
+ return new File(confDirectory, "elasticsearch.yml");
+ }
+
+ public File getJvmOptions() {
+ return new File(confDirectory, "jvm.options");
+ }
+}
*/
package org.sonar.process.es;
-import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
private static final String STANDALONE_NODE_NAME = "sonarqube";
private final Props props;
+ private final EsFileSystem fileSystem;
private final boolean clusterEnabled;
private final String clusterName;
private final String nodeName;
- public EsSettings(Props props) {
+ public EsSettings(Props props, EsFileSystem fileSystem) {
this.props = props;
+ this.fileSystem = fileSystem;
this.clusterName = props.nonNullValue(ProcessProperties.CLUSTER_NAME);
this.clusterEnabled = props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED);
}
private void configureFileSystem(Map<String, String> builder) {
- File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
-
- builder.put("path.data", buildDataPath(homeDir).getAbsolutePath());
- builder.put("path.conf", buildConfDir().getAbsolutePath());
- builder.put("path.logs", buildLogPath(homeDir).getAbsolutePath());
- }
-
- private File buildDataPath(File homeDir) {
- String dataPath = props.value(ProcessProperties.PATH_DATA);
- if (StringUtils.isNotEmpty(dataPath)) {
- return new File(dataPath, "es");
- }
- return new File(homeDir, "data/es");
- }
-
- private File buildLogPath(File homeDir) {
- String logPath = props.value(ProcessProperties.PATH_LOGS);
- if (StringUtils.isNotEmpty(logPath)) {
- return new File(logPath);
- }
- return new File(homeDir, "log");
- }
-
- private File buildConfDir() {
- String tempPath = props.value(ProcessProperties.PATH_TEMP);
- return new File(new File(tempPath, "conf"), "es");
+ builder.put("path.data", fileSystem.getDataDirectory().getAbsolutePath());
+ builder.put("path.conf", fileSystem.getConfDirectory().getAbsolutePath());
+ builder.put("path.logs", fileSystem.getLogDirectory().getAbsolutePath());
}
private void configureNetwork(Map<String, String> builder) {
--- /dev/null
+/*
+ * 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.process.es;
+
+import java.io.File;
+import java.io.IOException;
+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 EsFileSystemTest {
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void constructor_fails_with_IAE_if_sq_home_property_is_not_defined() {
+ Props props = new Props(new Properties());
+
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Property sonar.path.home is not set");
+
+ new EsFileSystem(props);
+ }
+
+ @Test
+ public void constructor_fails_with_IAE_if_temp_dir_property_is_not_defined() throws IOException {
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
+
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Property sonar.path.temp is not set");
+
+ new EsFileSystem(props);
+ }
+
+ @Test
+ public void getHomeDirectory_is_elasticsearch_subdirectory_of_sq_home_directory() throws IOException {
+ File sqHomeDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, temp.newFolder().getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getHomeDirectory()).isEqualTo(new File(sqHomeDir, "elasticsearch"));
+ }
+
+ @Test
+ public void getDataDirectory_is_data_es_subdirectory_of_sq_home_directory_by_default() throws IOException {
+ File sqHomeDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, temp.newFolder().getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getDataDirectory()).isEqualTo(new File(sqHomeDir, "data/es"));
+ }
+
+ @Test
+ public void override_data_dir() throws Exception {
+ File sqHomeDir = temp.newFolder();
+ File tempDir = temp.newFolder();
+ File dataDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ props.set(ProcessProperties.PATH_DATA, dataDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getDataDirectory()).isEqualTo(new File(dataDir, "es"));
+ }
+
+ @Test
+ public void getLogDirectory_is_log_subdirectory_of_sq_home_directory_by_default() throws IOException {
+ File sqHomeDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, temp.newFolder().getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getLogDirectory()).isEqualTo(new File(sqHomeDir, "log"));
+ }
+
+ @Test
+ public void override_log_dir() throws Exception {
+ File sqHomeDir = temp.newFolder();
+ File tempDir = temp.newFolder();
+ File logDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ props.set(ProcessProperties.PATH_LOGS, logDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getDataDirectory()).isEqualTo(new File(sqHomeDir, "data/es"));
+ }
+
+ @Test
+ public void conf_directory_is_conf_es_subdirectory_of_sq_temp_directory() throws IOException {
+ File tempDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getConfDirectory()).isEqualTo(new File(tempDir, "conf/es"));
+ }
+
+ @Test
+ public void getExecutable_resolve_executable_for_platform() throws IOException {
+ File sqHomeDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, sqHomeDir.getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, temp.newFolder().getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ assertThat(underTest.getExecutable()).isEqualTo(new File(sqHomeDir, "elasticsearch/bin/elasticsearch.bat"));
+ } else {
+ assertThat(underTest.getExecutable()).isEqualTo(new File(sqHomeDir, "elasticsearch/bin/elasticsearch"));
+ }
+ }
+
+ @Test
+ public void getLog4j2Properties_is_in_es_conf_directory() throws IOException {
+ File tempDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getLog4j2Properties()).isEqualTo(new File(tempDir, "conf/es/log4j2.properties"));
+ }
+
+ @Test
+ public void getElasticsearchYml_is_in_es_conf_directory() throws IOException {
+ File tempDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getElasticsearchYml()).isEqualTo(new File(tempDir, "conf/es/elasticsearch.yml"));
+ }
+
+ @Test
+ public void getJvmOptions_is_in_es_conf_directory() throws IOException {
+ File tempDir = temp.newFolder();
+ Props props = new Props(new Properties());
+ props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
+ props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
+
+ EsFileSystem underTest = new EsFileSystem(props);
+
+ assertThat(underTest.getJvmOptions()).isEqualTo(new File(tempDir, "conf/es/jvm.options"));
+ }
+}
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
+import java.util.Random;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.process.Props;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class EsSettingsTest {
private static final boolean CLUSTER_ENABLED = true;
private static final boolean CLUSTER_DISABLED = false;
-
+
@Rule
public TemporaryFolder temp = new TemporaryFolder();
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.PATH_TEMP, temp.newFolder().getAbsolutePath());
props.set(ProcessProperties.CLUSTER_NAME, "sonarqube");
- EsSettings esSettings = new EsSettings(props);
+ EsSettings esSettings = new EsSettings(props, new EsFileSystem(props));
Map<String, String> generated = esSettings.build();
assertThat(generated.get("transport.tcp.port")).isEqualTo("1234");
}
@Test
- public void override_dirs() throws Exception {
- File dataDir = temp.newFolder();
- File logDir = temp.newFolder();
- File tempDir = temp.newFolder();
- Props props = minProps(CLUSTER_DISABLED);
- 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")).isNull();
- assertThat(settings.get("path.conf")).isEqualTo(new File(tempDir, "conf/es").getAbsolutePath());
+ public void path_properties_are_values_from_EsFileSystem_argument() throws IOException {
+ EsFileSystem mockedEsFileSystem = mock(EsFileSystem.class);
+ when(mockedEsFileSystem.getHomeDirectory()).thenReturn(new File("/foo/home"));
+ when(mockedEsFileSystem.getConfDirectory()).thenReturn(new File("/foo/conf"));
+ when(mockedEsFileSystem.getLogDirectory()).thenReturn(new File("/foo/log"));
+ when(mockedEsFileSystem.getDataDirectory()).thenReturn(new File("/foo/data"));
+
+ EsSettings underTest = new EsSettings(minProps(new Random().nextBoolean()), mockedEsFileSystem);
+
+ Map<String, String> generated = underTest.build();
+ assertThat(generated.get("path.data")).isEqualTo("/foo/data");
+ assertThat(generated.get("path.logs")).isEqualTo("/foo/log");
+ assertThat(generated.get("path.conf")).isEqualTo("/foo/conf");
}
@Test
public void set_discovery_settings_if_cluster_is_enabled() throws Exception {
Props props = minProps(CLUSTER_ENABLED);
props.set(ProcessProperties.CLUSTER_SEARCH_HOSTS, "1.2.3.4:9000,1.2.3.5:8080");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(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");
Props props = minProps(CLUSTER_ENABLED);
props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "ꝱꝲꝳପ");
- EsSettings underTest = new EsSettings(props);
+ EsSettings underTest = new EsSettings(props, new EsFileSystem(props));
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Value of property sonar.search.minimumMasterNodes is not an integer:");
public void cluster_is_enabled_with_defined_minimum_master_nodes() throws Exception {
Props props = minProps(CLUSTER_ENABLED);
props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("5");
}
public void cluster_is_enabled_with_defined_initialTimeout() throws Exception {
Props props = minProps(CLUSTER_ENABLED);
props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("10s");
}
public void in_standalone_initialTimeout_is_not_overridable() throws Exception {
Props props = minProps(CLUSTER_DISABLED);
props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("30s");
}
public void in_standalone_minimumMasterNodes_is_not_overridable() throws Exception {
Props props = minProps(CLUSTER_DISABLED);
props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("1");
}
-
-
@Test
public void enable_marvel() throws Exception {
Props props = minProps(CLUSTER_DISABLED);
props.set("sonar.search.marvelHosts", "127.0.0.2,127.0.0.3");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
}
public void enable_http_connector() throws Exception {
Props props = minProps(CLUSTER_DISABLED);
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("http.port")).isEqualTo("9010");
assertThat(settings.get("http.host")).isEqualTo("127.0.0.1");
Props props = minProps(CLUSTER_DISABLED);
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
props.set(ProcessProperties.SEARCH_HOST, "127.0.0.2");
- Map<String, String> settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props, new EsFileSystem(props)).build();
assertThat(settings.get("http.port")).isEqualTo("9010");
assertThat(settings.get("http.host")).isEqualTo("127.0.0.2");