From b35205ac59d363548b245b3ec8ed742a68fbf22a Mon Sep 17 00:00:00 2001 From: Eric Hartmann Date: Fri, 17 Mar 2017 17:54:14 +0100 Subject: SONAR-8938 Remove sonar.search.clusterName in favor of sonar.cluster.name (#1795) --- .../org/sonar/application/cluster/ClusterProperties.java | 9 +-------- .../sonar/application/cluster/ClusterPropertiesTest.java | 16 +--------------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'server/sonar-process-monitor') 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 @@ -87,19 +86,6 @@ public class ClusterPropertiesTest { clusterProperties.validate(); } - @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"); -- cgit v1.2.3