diff options
author | Eric Hartmann <hartmann.eric@gmail.Com> | 2017-03-17 17:54:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-17 17:54:14 +0100 |
commit | b35205ac59d363548b245b3ec8ed742a68fbf22a (patch) | |
tree | 9c2e878e37396071a0b7013e5c028c8ec1bd456b /server/sonar-process-monitor | |
parent | 8759b3933d8bc4a147b7242e1838a39b82bcc719 (diff) | |
download | sonarqube-b35205ac59d363548b245b3ec8ed742a68fbf22a.tar.gz sonarqube-b35205ac59d363548b245b3ec8ed742a68fbf22a.zip |
SONAR-8938 Remove sonar.search.clusterName in favor of sonar.cluster.name (#1795)
Diffstat (limited to 'server/sonar-process-monitor')
2 files changed, 2 insertions, 23 deletions
diff --git a/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProperties.java b/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProperties.java index 661919efbd9..e8287c24d74 100644 --- a/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProperties.java +++ b/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProperties.java @@ -52,7 +52,7 @@ public final class ClusterProperties { networkInterfaces = extractNetworkInterfaces( appSettings.getProps().value(ProcessProperties.CLUSTER_NETWORK_INTERFACES, "") ); - name = appSettings.getProps().value(ProcessProperties.CLUSTER_NAME); + name = appSettings.getProps().nonNullValue(ProcessProperties.CLUSTER_NAME); hosts = extractHosts( appSettings.getProps().value(ProcessProperties.CLUSTER_HOSTS, "") ); @@ -82,13 +82,6 @@ public final class ClusterProperties { if (!enabled) { return; } - // Name is required in cluster mode - checkArgument( - StringUtils.isNotEmpty(name), - "Cluster have been enabled but a %s has not been defined.", - ProcessProperties.CLUSTER_NAME - ); - // Test validity of port checkArgument( port > 0 && port < 65_536, diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/ClusterPropertiesTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/ClusterPropertiesTest.java index 46013fa9811..05e471c7ffd 100644 --- a/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/ClusterPropertiesTest.java +++ b/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/ClusterPropertiesTest.java @@ -41,7 +41,6 @@ public class ClusterPropertiesTest { @Test public void test_default_values() throws Exception { - ClusterProperties props = new ClusterProperties(appSettings); assertThat(props.getNetworkInterfaces()) @@ -53,7 +52,7 @@ public class ClusterPropertiesTest { assertThat(props.getHosts()) .isEqualTo(Collections.emptyList()); assertThat(props.getName()) - .isEqualTo(""); + .isEqualTo("sonarqube"); } @Test @@ -88,19 +87,6 @@ public class ClusterPropertiesTest { } @Test - public void test_missing_name() { - appSettings.getProps().set(ProcessProperties.CLUSTER_ENABLED, "true"); - appSettings.getProps().set(ProcessProperties.CLUSTER_NAME, ""); - - ClusterProperties clusterProperties = new ClusterProperties(appSettings); - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage( - String.format("Cluster have been enabled but a %s has not been defined.", - ProcessProperties.CLUSTER_NAME)); - clusterProperties.validate(); - } - - @Test public void validate_does_not_fail_if_cluster_enabled_and_name_specified() { appSettings.getProps().set(ProcessProperties.CLUSTER_ENABLED, "true"); appSettings.getProps().set(ProcessProperties.CLUSTER_NAME, "sonarqube"); |