use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsTest method verifyAnyHostsConfigurationIsValid.
private void verifyAnyHostsConfigurationIsValid(String searchPropertyValue) {
TestAppSettings settings = new TestAppSettings(ImmutableMap.<String, String>builder().put(CLUSTER_ENABLED.getKey(), "true").put(CLUSTER_NODE_TYPE.getKey(), "search").put(CLUSTER_NODE_SEARCH_HOST.getKey(), "search_host").put(CLUSTER_ES_HOSTS.getKey(), "transport_host,transport_host").put(CLUSTER_NODE_ES_HOST.getKey(), "transport_host").put(CLUSTER_SEARCH_HOSTS.getKey(), searchPropertyValue).build());
ClusterSettings clusterSettings = new ClusterSettings(network);
Props props = settings.getProps();
assertThatCode(() -> clusterSettings.accept(props)).doesNotThrowAnyException();
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsTest method verifyLoopbackChecked.
private void verifyLoopbackChecked(TestAppSettings settings, Collection<String> hosts, String expectedMessage) {
reset(network);
mockAllHostsValid();
mockLocalNonLoopback("hz_host", "search_host", "transport_host");
// will overwrite above move if necessary
hosts.forEach(this::mockLoopback);
ClusterSettings clusterSettings = new ClusterSettings(network);
Props props = settings.getProps();
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage(expectedMessage);
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsTest method accept_throws_MessageException_if_h2_on_application_node.
@Test
@UseDataProvider("validIPv4andIPv6Addresses")
public void accept_throws_MessageException_if_h2_on_application_node(String host) {
TestAppSettings settings = newSettingsForAppNode(host, of("sonar.jdbc.url", "jdbc:h2:mem"));
ClusterSettings clusterSettings = new ClusterSettings(network);
Props props = settings.getProps();
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage("Embedded database is not supported in cluster mode");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsTest method accept_throws_MessageException_on_application_node_if_default_jdbc_url.
@Test
@UseDataProvider("validIPv4andIPv6Addresses")
public void accept_throws_MessageException_on_application_node_if_default_jdbc_url(String host) {
TestAppSettings settings = newSettingsForAppNode(host);
settings.clearProperty(JDBC_URL.getKey());
ClusterSettings clusterSettings = new ClusterSettings(network);
Props props = settings.getProps();
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage("Embedded database is not supported in cluster mode");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ClusterSettingsTest method verifyHostIsChecked.
private void verifyHostIsChecked(TestAppSettings settings, Collection<String> invalidHosts, String expectedMessage) {
reset(network);
mockAllHostsValidBut(invalidHosts);
mockLocalNonLoopback("hz_host", "search_host");
ClusterSettings clusterSettings = new ClusterSettings(network);
Props props = settings.getProps();
assertThatThrownBy(() -> clusterSettings.accept(props)).isInstanceOf(MessageException.class).hasMessage(expectedMessage);
}
Aggregations