use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method in_standalone_initialTimeout_is_not_overridable.
@Test
public void in_standalone_initialTimeout_is_not_overridable() throws Exception {
Props props = minProps(CLUSTER_DISABLED);
props.set(SEARCH_INITIAL_STATE_TIMEOUT.getKey(), "10s");
Map<String, String> settings = new EsSettings(props, new EsInstallation(props), system).build();
assertThat(settings).containsEntry("discovery.initial_state_timeout", "30s");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method minimalProps.
private Props minimalProps() {
Props props = new Props(new Properties());
props.set(PATH_HOME.getKey(), randomAlphanumeric(12));
props.set(PATH_DATA.getKey(), randomAlphanumeric(12));
props.set(PATH_TEMP.getKey(), randomAlphanumeric(12));
props.set(PATH_LOGS.getKey(), randomAlphanumeric(12));
props.set(CLUSTER_NAME.getKey(), randomAlphanumeric(12));
return props;
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method test_default_settings_for_standalone_mode.
@Test
public void test_default_settings_for_standalone_mode() throws Exception {
File homeDir = temp.newFolder();
Props props = new Props(new Properties());
props.set(SEARCH_PORT.getKey(), "1234");
props.set(ES_PORT.getKey(), "5678");
props.set(SEARCH_HOST.getKey(), "127.0.0.1");
props.set(PATH_HOME.getKey(), homeDir.getAbsolutePath());
props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
props.set(PATH_TEMP.getKey(), temp.newFolder().getAbsolutePath());
props.set(PATH_LOGS.getKey(), temp.newFolder().getAbsolutePath());
props.set(CLUSTER_NAME.getKey(), "sonarqube");
EsSettings esSettings = new EsSettings(props, new EsInstallation(props), system);
Map<String, String> generated = esSettings.build();
assertThat(generated).containsEntry("transport.port", "5678").containsEntry("transport.host", "127.0.0.1").containsEntry("http.port", "1234").containsEntry("http.host", "127.0.0.1").containsEntry("cluster.name", "sonarqube").containsEntry("node.name", "sonarqube").containsEntry("discovery.seed_hosts", "127.0.0.1").containsEntry("cluster.initial_master_nodes", "127.0.0.1");
assertThat(generated.get("path.data")).isNotNull();
assertThat(generated.get("path.logs")).isNotNull();
assertThat(generated.get("path.home")).isNull();
assertThat(generated.get("path.conf")).isNull();
assertThat(generated).containsEntry("discovery.initial_state_timeout", "30s").containsEntry("action.auto_create_index", "false");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsLoopbackTest method ClusterSettings_throws_MessageException_if_es_transport_host_of_search_node_is_loopback.
@Test
public void ClusterSettings_throws_MessageException_if_es_transport_host_of_search_node_is_loopback() {
TestAppSettings settings = newSettingsForSearchNode(ImmutableMap.of(CLUSTER_NODE_ES_HOST.getKey(), loopback.getHostAddress()));
Props props = settings.getProps();
ClusterSettings clusterSettings = new ClusterSettings(network);
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage("Property " + CLUSTER_NODE_ES_HOST.getKey() + " must be a local non-loopback address: " + loopback.getHostAddress());
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsLoopbackTest method ClusterSettings_throws_MessageException_if_host_of_app_node_is_loopback.
@Test
public void ClusterSettings_throws_MessageException_if_host_of_app_node_is_loopback() {
TestAppSettings settings = newSettingsForAppNode(ImmutableMap.of(CLUSTER_NODE_HOST.getKey(), loopback.getHostAddress()));
Props props = settings.getProps();
ClusterSettings clusterSettings = new ClusterSettings(network);
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage("Property " + CLUSTER_NODE_HOST.getKey() + " must be a local non-loopback address: " + loopback.getHostAddress());
}
Aggregations