]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10604 property sonar.cluster.hosts is only for app nodes
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 7 May 2018 09:00:16 +0000 (11:00 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 10 May 2018 18:20:55 +0000 (20:20 +0200)
13 files changed:
server/sonar-main/src/main/java/org/sonar/application/AppStateFactory.java
server/sonar-main/src/main/java/org/sonar/application/cluster/health/SearchNodeHealthProvider.java
server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java
server/sonar-main/src/test/java/org/sonar/application/AppStateFactoryTest.java
server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java
server/sonar-main/src/test/java/org/sonar/application/cluster/health/SearchNodeHealthProviderTest.java
server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java
server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java
server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java
server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java
server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberBuilderTest.java
server/sonar-server/src/main/java/org/sonar/server/health/NodeHealthProviderImpl.java
server/sonar-server/src/test/java/org/sonar/server/health/NodeHealthProviderImplTest.java

index 7c43140a3e2176a60850d60c30c9e72cd0ec02da..a9ea92b9de76c2d01146341183b00948f1a1f9c8 100644 (file)
@@ -34,11 +34,11 @@ import org.sonar.process.cluster.hz.HazelcastMember;
 import org.sonar.process.cluster.hz.HazelcastMemberBuilder;
 
 import static java.util.Arrays.asList;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_HOSTS;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_HZ_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NAME;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_SEARCH_HOSTS;
 
 public class AppStateFactory {
@@ -61,9 +61,9 @@ public class AppStateFactory {
   private static HazelcastMember createHzMember(Props props) {
     HazelcastMemberBuilder builder = new HazelcastMemberBuilder()
       .setNetworkInterface(props.nonNullValue(CLUSTER_NODE_HOST.getKey()))
-      .setMembers(asList(props.nonNullValue(CLUSTER_HOSTS.getKey()).split(",")))
+      .setMembers(asList(props.nonNullValue(CLUSTER_HZ_HOSTS.getKey()).split(",")))
       .setNodeName(props.nonNullValue(CLUSTER_NODE_NAME.getKey()))
-      .setPort(Integer.parseInt(props.nonNullValue(CLUSTER_NODE_PORT.getKey())))
+      .setPort(Integer.parseInt(props.nonNullValue(CLUSTER_NODE_HZ_PORT.getKey())))
       .setProcessId(ProcessId.APP);
     return builder.build();
   }
index 56a84cff1f9fde3a5c44a28c209c8e476c680404..8404e0288ce322804e4aacd19b91422824cac1f5 100644 (file)
@@ -29,7 +29,7 @@ import org.sonar.process.cluster.health.NodeHealthProvider;
 
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 
 public class SearchNodeHealthProvider implements NodeHealthProvider {
 
@@ -46,7 +46,7 @@ public class SearchNodeHealthProvider implements NodeHealthProvider {
       .setType(NodeDetails.Type.SEARCH)
       .setName(props.nonNullValue(CLUSTER_NODE_NAME.getKey()))
       .setHost(getHost(props, networkUtils))
-      .setPort(Integer.valueOf(props.nonNullValue(CLUSTER_NODE_PORT.getKey())))
+      .setPort(Integer.valueOf(props.nonNullValue(CLUSTER_NODE_HZ_PORT.getKey())))
       .setStartedAt(clock.now())
       .build();
   }
index 1aafe77daa1806e7518b920ba83a79e7c86da658..c3d81b599277f2b3b7da3b38e22287d629b7ee4c 100644 (file)
@@ -41,9 +41,9 @@ import static java.util.stream.Collectors.joining;
 import static org.apache.commons.lang.StringUtils.isBlank;
 import static org.sonar.process.ProcessProperties.Property.AUTH_JWT_SECRET;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_HOSTS;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_HZ_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_SEARCH_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_WEB_STARTUP_LEADER;
@@ -76,18 +76,18 @@ public class ClusterSettings implements Consumer<Props> {
       case APPLICATION:
         ensureNotH2(props);
         requireValue(props, AUTH_JWT_SECRET.getKey());
+        ensureNotLoopbackAddresses(props, CLUSTER_HZ_HOSTS.getKey());
         break;
       case SEARCH:
         requireValue(props, SEARCH_HOST.getKey());
         ensureLocalButNotLoopbackAddress(props, SEARCH_HOST.getKey());
-        if (props.contains(CLUSTER_NODE_PORT.getKey())) {
-          LoggerFactory.getLogger(getClass()).warn("Property {} is ignored on search nodes since 7.2", CLUSTER_NODE_PORT.getKey());
+        if (props.contains(CLUSTER_NODE_HZ_PORT.getKey())) {
+          LoggerFactory.getLogger(getClass()).warn("Property {} is ignored on search nodes since 7.2", CLUSTER_NODE_HZ_PORT.getKey());
         }
         break;
       default:
         throw new UnsupportedOperationException("Unknown value: " + nodeType);
     }
-    ensureNotLoopbackAddresses(props, CLUSTER_HOSTS.getKey());
     requireValue(props, CLUSTER_NODE_HOST.getKey());
     ensureLocalButNotLoopbackAddress(props, CLUSTER_NODE_HOST.getKey());
     ensureNotLoopbackAddresses(props, CLUSTER_SEARCH_HOSTS.getKey());
index 666cecada3ce121582086f729153e4d81179324b..bbafdb4e3ab8d6daa9182ed2060681aed0b1c10d 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.process.NetworkUtilsImpl;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assume.assumeThat;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_HOSTS;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_HZ_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NAME;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
@@ -49,7 +49,7 @@ public class AppStateFactoryTest {
     settings.set(CLUSTER_ENABLED.getKey(), "true");
     settings.set(CLUSTER_NODE_TYPE.getKey(), "application");
     settings.set(CLUSTER_NODE_HOST.getKey(), ip.get().getHostAddress());
-    settings.set(CLUSTER_HOSTS.getKey(), ip.get().getHostAddress());
+    settings.set(CLUSTER_HZ_HOSTS.getKey(), ip.get().getHostAddress());
     settings.set(CLUSTER_NAME.getKey(), "foo");
     settings.set(CLUSTER_SEARCH_HOSTS.getKey(), "localhost:9001");
 
index 32198868801e7c0832bd364c6e86c0db8b4c3f90..5fbca0ae68bcce5fdb72463789bd8ebe49275fb1 100644 (file)
@@ -58,7 +58,7 @@ import static org.sonar.process.ProcessId.WEB_SERVER;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
 
 public class SchedulerImplTest {
@@ -321,7 +321,7 @@ public class SchedulerImplTest {
   private void addRequiredNodeProperties() {
     settings.set(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(4));
     settings.set(CLUSTER_NODE_HOST.getKey(), randomAlphanumeric(4));
-    settings.set(CLUSTER_NODE_PORT.getKey(), String.valueOf(1 + new Random().nextInt(999)));
+    settings.set(CLUSTER_NODE_HZ_PORT.getKey(), String.valueOf(1 + new Random().nextInt(999)));
   }
 
   private class TestCommandFactory implements CommandFactory {
index fd322b38aa921d0d64395c16be269632b5f9024b..b6d26918e7ec3f1d333dfaedee8c76536f79f496 100644 (file)
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 
 public class SearchNodeHealthProviderTest {
   @Rule
@@ -89,7 +89,7 @@ public class SearchNodeHealthProviderTest {
     String port = randomAlphabetic(3);
     Properties properties = new Properties();
     properties.put(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    properties.put(CLUSTER_NODE_PORT.getKey(), port);
+    properties.put(CLUSTER_NODE_HZ_PORT.getKey(), port);
     when(networkUtils.getHostname()).thenReturn(randomAlphanumeric(34));
     Props props = new Props(properties);
 
@@ -105,7 +105,7 @@ public class SearchNodeHealthProviderTest {
     int port = 1 + random.nextInt(4);
     Properties properties = new Properties();
     properties.setProperty(CLUSTER_NODE_NAME.getKey(), name);
-    properties.setProperty(CLUSTER_NODE_PORT.getKey(), valueOf(port));
+    properties.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), valueOf(port));
     when(networkUtils.getHostname()).thenReturn(randomAlphanumeric(34));
     when(clock.now()).thenReturn(1L + random.nextInt(87));
     SearchNodeHealthProvider underTest = new SearchNodeHealthProvider(new Props(properties), clusterAppState, networkUtils, clock);
@@ -117,7 +117,7 @@ public class SearchNodeHealthProviderTest {
 
     // change values in properties
     properties.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(6));
-    properties.setProperty(CLUSTER_NODE_PORT.getKey(), valueOf(1 + random.nextInt(99)));
+    properties.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), valueOf(1 + random.nextInt(99)));
 
     NodeHealth newNodeHealth = underTest.get();
 
@@ -130,7 +130,7 @@ public class SearchNodeHealthProviderTest {
     String host = randomAlphanumeric(55);
     Properties properties = new Properties();
     properties.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    properties.setProperty(CLUSTER_NODE_PORT.getKey(), valueOf(1 + random.nextInt(4)));
+    properties.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), valueOf(1 + random.nextInt(4)));
     properties.setProperty(CLUSTER_NODE_HOST.getKey(), host);
     when(clock.now()).thenReturn(1L + random.nextInt(87));
     SearchNodeHealthProvider underTest = new SearchNodeHealthProvider(new Props(properties), clusterAppState, networkUtils, clock);
@@ -161,7 +161,7 @@ public class SearchNodeHealthProviderTest {
     String host = randomAlphanumeric(34);
     Properties properties = new Properties();
     properties.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    properties.setProperty(CLUSTER_NODE_PORT.getKey(), valueOf(1 + random.nextInt(4)));
+    properties.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), valueOf(1 + random.nextInt(4)));
     if (hostPropertyValue != null) {
       properties.setProperty(CLUSTER_NODE_HOST.getKey(), hostPropertyValue);
     }
@@ -226,7 +226,7 @@ public class SearchNodeHealthProviderTest {
 
   private long setRequiredPropertiesAndMocks(Properties properties) {
     properties.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    properties.setProperty(CLUSTER_NODE_PORT.getKey(), valueOf(1 + random.nextInt(4)));
+    properties.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), valueOf(1 + random.nextInt(4)));
     long now = 1L + random.nextInt(87);
     when(clock.now()).thenReturn(now);
     when(networkUtils.getHostname()).thenReturn(randomAlphanumeric(34));
index 6e907ab3f40c6a23753539b3e2e05694205d9620..8463107e965dc57dac1aa2cd925dd0703b6f69e8 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.process.NetworkUtilsImpl;
 import static org.junit.Assume.assumeThat;
 import static org.mockito.Mockito.spy;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_HOSTS;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_HZ_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_SEARCH_HOSTS;
@@ -61,7 +61,7 @@ public class ClusterSettingsLoopbackTest {
   public void ClusterSettings_throws_MessageException_if_host_of_search_node_is_loopback() {
     verifySearchFailureIfLoopback(CLUSTER_NODE_HOST.getKey());
     verifySearchFailureIfLoopback(CLUSTER_SEARCH_HOSTS.getKey());
-    verifySearchFailureIfLoopback(CLUSTER_HOSTS.getKey());
+    verifySearchFailureIfLoopback(CLUSTER_HZ_HOSTS.getKey());
     verifySearchFailureIfLoopback(SEARCH_HOST.getKey());
   }
 
@@ -69,7 +69,7 @@ public class ClusterSettingsLoopbackTest {
   public void ClusterSettings_throws_MessageException_if_host_of_app_node_is_loopback() {
     verifyAppFailureIfLoopback(CLUSTER_NODE_HOST.getKey());
     verifyAppFailureIfLoopback(CLUSTER_SEARCH_HOSTS.getKey());
-    verifyAppFailureIfLoopback(CLUSTER_HOSTS.getKey());
+    verifyAppFailureIfLoopback(CLUSTER_HZ_HOSTS.getKey());
   }
 
   private void verifySearchFailureIfLoopback(String propertyKey) {
@@ -96,7 +96,7 @@ public class ClusterSettingsLoopbackTest {
       .set(CLUSTER_ENABLED.getKey(), "true")
       .set(CLUSTER_NODE_TYPE.getKey(), "application")
       .set(CLUSTER_NODE_HOST.getKey(), nonLoopbackLocal.getHostAddress())
-      .set(CLUSTER_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
+      .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set("sonar.auth.jwtBase64Hs256Secret", "abcde")
       .set(JDBC_URL.getKey(), "jdbc:mysql://localhost:3306/sonar");
@@ -107,7 +107,7 @@ public class ClusterSettingsLoopbackTest {
       .set(CLUSTER_ENABLED.getKey(), "true")
       .set(CLUSTER_NODE_TYPE.getKey(), "search")
       .set(CLUSTER_NODE_HOST.getKey(), nonLoopbackLocal.getHostAddress())
-      .set(CLUSTER_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
+      .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(SEARCH_HOST.getKey(), nonLoopbackLocal.getHostAddress());
   }
index c79dcd137070bb61562ad5ff69172806e02a5fb6..63be00ed2b268075c830a58821ae1a9820cdbb32 100644 (file)
@@ -36,7 +36,7 @@ import static org.sonar.process.ProcessId.COMPUTE_ENGINE;
 import static org.sonar.process.ProcessId.ELASTICSEARCH;
 import static org.sonar.process.ProcessId.WEB_SERVER;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_HOSTS;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_HZ_HOSTS;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_TYPE;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_SEARCH_HOSTS;
@@ -221,10 +221,10 @@ public class ClusterSettingsTest {
   }
 
   @Test
-  public void accept_throws_MessageException_if_clusterHosts_is_missing() {
-    TestAppSettings settings = newSettingsForSearchNode();
-    settings.clearProperty(CLUSTER_HOSTS.getKey());
-    assertThatPropertyIsMandatory(settings, CLUSTER_HOSTS.getKey());
+  public void accept_throws_MessageException_on_app_node_if_clusterHosts_is_missing() {
+    TestAppSettings settings = newSettingsForAppNode();
+    settings.clearProperty(CLUSTER_HZ_HOSTS.getKey());
+    assertThatPropertyIsMandatory(settings, CLUSTER_HZ_HOSTS.getKey());
   }
 
   @Test
@@ -277,7 +277,7 @@ public class ClusterSettingsTest {
       .set(CLUSTER_ENABLED.getKey(), "true")
       .set(CLUSTER_NODE_TYPE.getKey(), "application")
       .set(CLUSTER_NODE_HOST.getKey(), nonLoopbackLocal.getHostAddress())
-      .set(CLUSTER_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
+      .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set("sonar.auth.jwtBase64Hs256Secret", "abcde")
       .set(JDBC_URL.getKey(), "jdbc:mysql://localhost:3306/sonar");
@@ -288,7 +288,7 @@ public class ClusterSettingsTest {
       .set(CLUSTER_ENABLED.getKey(), "true")
       .set(CLUSTER_NODE_TYPE.getKey(), "search")
       .set(CLUSTER_NODE_HOST.getKey(), nonLoopbackLocal.getHostAddress())
-      .set(CLUSTER_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
+      .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress())
       .set(SEARCH_HOST.getKey(), nonLoopbackLocal.getHostAddress());
   }
index b4d76fa889d56262afcf43215fafabd4cc3dfd22..55a3bb7304afd907273a002981133419b96d3703 100644 (file)
@@ -84,8 +84,8 @@ public class ProcessProperties {
     CLUSTER_ENABLED("sonar.cluster.enabled", "false"),
     CLUSTER_NODE_TYPE("sonar.cluster.node.type"),
     CLUSTER_SEARCH_HOSTS("sonar.cluster.search.hosts"),
-    CLUSTER_HOSTS("sonar.cluster.hosts"),
-    CLUSTER_NODE_PORT("sonar.cluster.node.port", "9003"),
+    CLUSTER_HZ_HOSTS("sonar.cluster.hosts"),
+    CLUSTER_NODE_HZ_PORT("sonar.cluster.node.port", "9003"),
     CLUSTER_NODE_HOST("sonar.cluster.node.host"),
     CLUSTER_NODE_NAME("sonar.cluster.node.name", "sonarqube-" + UUID.randomUUID().toString()),
     CLUSTER_NAME("sonar.cluster.name", "sonarqube"),
index 338cc6ad1f1dc5cdb6ca2d2cba04742d27292e9a..ac62551c4e7253239907ae2ab0754de07b8000c7 100644 (file)
@@ -35,7 +35,7 @@ import org.sonar.process.cluster.hz.HazelcastMember.Attribute;
 import static java.lang.String.format;
 import static java.util.Collections.singletonList;
 import static java.util.Objects.requireNonNull;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 
 public class HazelcastMemberBuilder {
 
@@ -79,7 +79,7 @@ public class HazelcastMemberBuilder {
    */
   public HazelcastMemberBuilder setMembers(Collection<String> c) {
     this.members = c.stream()
-      .map(host -> host.contains(":") ? host : format("%s:%s", host, CLUSTER_NODE_PORT.getDefaultValue()))
+      .map(host -> host.contains(":") ? host : format("%s:%s", host, CLUSTER_NODE_HZ_PORT.getDefaultValue()))
       .collect(Collectors.toList());
     return this;
   }
index f30be9e526fcb6cedb022204c3b41ea376529201..810704a67e885f8dbd216d1082fae3eab3603d78 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.process.ProcessId;
 
 import static java.util.Arrays.asList;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 
 public class HazelcastMemberBuilderTest {
 
@@ -70,9 +70,9 @@ public class HazelcastMemberBuilderTest {
     underTest.setMembers(asList("foo", "bar:9100", "1.2.3.4"));
 
     assertThat(underTest.getMembers()).containsExactly(
-      "foo:" + CLUSTER_NODE_PORT.getDefaultValue(),
+      "foo:" + CLUSTER_NODE_HZ_PORT.getDefaultValue(),
       "bar:9100",
-      "1.2.3.4:" + CLUSTER_NODE_PORT.getDefaultValue());
+      "1.2.3.4:" + CLUSTER_NODE_HZ_PORT.getDefaultValue());
   }
 
   @Test
index af749b4926b1127e0edd9eb0a35343efbfb4e9ab..37eb9741005afd809a4b22efdcae167aa4be4905 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.process.cluster.health.NodeHealthProvider;
 import static java.lang.String.format;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 import static org.sonar.process.cluster.health.NodeDetails.newNodeDetailsBuilder;
 import static org.sonar.process.cluster.health.NodeHealth.newNodeHealthBuilder;
 
@@ -63,8 +63,8 @@ public class NodeHealthProviderImpl implements NodeHealthProvider {
   }
 
   private static int computePort(Configuration configuration) {
-    return configuration.getInt(CLUSTER_NODE_PORT.getKey())
-      .orElseThrow(missingPropertyISE(CLUSTER_NODE_PORT.getKey()));
+    return configuration.getInt(CLUSTER_NODE_HZ_PORT.getKey())
+      .orElseThrow(missingPropertyISE(CLUSTER_NODE_HZ_PORT.getKey()));
   }
 
   private static Supplier<IllegalStateException> missingPropertyISE(String propertyName) {
index 38f7f9e39d5289c2f73bf45c8837fcc85c755f06..0c8753a3416df4e462e664b8423dfac6d2972fd8 100644 (file)
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HOST;
 import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME;
-import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_PORT;
+import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_HZ_PORT;
 
 public class NodeHealthProviderImplTest {
   @Rule
@@ -127,7 +127,7 @@ public class NodeHealthProviderImplTest {
     String name = randomAlphanumeric(3);
     int port = 1 + random.nextInt(4);
     mapSettings.setProperty(CLUSTER_NODE_NAME.getKey(), name);
-    mapSettings.setProperty(CLUSTER_NODE_PORT.getKey(), port);
+    mapSettings.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), port);
     setStartedAt();
     when(healthChecker.checkNode()).thenReturn(Health.newHealthCheckBuilder()
       .setStatus(Health.Status.values()[random.nextInt(Health.Status.values().length)])
@@ -153,7 +153,7 @@ public class NodeHealthProviderImplTest {
   public void get_returns_host_from_property_if_set_at_constructor_time() {
     String host = randomAlphanumeric(4);
     mapSettings.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    mapSettings.setProperty(CLUSTER_NODE_PORT.getKey(), 1 + random.nextInt(4));
+    mapSettings.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), 1 + random.nextInt(4));
     mapSettings.setProperty(CLUSTER_NODE_HOST.getKey(), host);
     setStartedAt();
     when(healthChecker.checkNode()).thenReturn(Health.newHealthCheckBuilder()
@@ -237,6 +237,6 @@ public class NodeHealthProviderImplTest {
 
   private void setRequiredPropertiesForConstructor() {
     mapSettings.setProperty(CLUSTER_NODE_NAME.getKey(), randomAlphanumeric(3));
-    mapSettings.setProperty(CLUSTER_NODE_PORT.getKey(), 1 + random.nextInt(4));
+    mapSettings.setProperty(CLUSTER_NODE_HZ_PORT.getKey(), 1 + random.nextInt(4));
   }
 }