aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2021-04-13 09:14:07 +0200
committersonartech <sonartech@sonarsource.com>2021-04-15 20:03:44 +0000
commitd8130b676481993c2b258ea326a5778356d93085 (patch)
treefb6ee119dc0f4920a700a29e0603b7025235d7c8 /server/sonar-webserver-core
parent4e232156aab47f195c3558757df2b87a7153cfea (diff)
downloadsonarqube-d8130b676481993c2b258ea326a5778356d93085.tar.gz
sonarqube-d8130b676481993c2b258ea326a5778356d93085.zip
SONAR-14625 Upgrade to Hazelcast 4.2
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImpl.java6
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImplTest.java13
2 files changed, 9 insertions, 10 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImpl.java
index d2c45b8be67..d8db18f1d2a 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImpl.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImpl.java
@@ -19,8 +19,8 @@
*/
package org.sonar.server.platform.monitoring.cluster;
-import com.hazelcast.core.Member;
-import com.hazelcast.core.MemberSelector;
+import com.hazelcast.cluster.Member;
+import com.hazelcast.cluster.MemberSelector;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -57,7 +57,7 @@ public class AppNodesInfoLoaderImpl implements AppNodesInfoLoader {
MemberSelector memberSelector = HazelcastMemberSelectors.selectorForProcessIds(ProcessId.WEB_SERVER, ProcessId.COMPUTE_ENGINE);
DistributedAnswer<ProtobufSystemInfo.SystemInfo> distributedAnswer = hzMember.call(ProcessInfoProvider::provide, memberSelector, DISTRIBUTED_TIMEOUT_MS);
for (Member member : distributedAnswer.getMembers()) {
- String nodeName = member.getStringAttribute(NODE_NAME.getKey());
+ String nodeName = member.getAttribute(NODE_NAME.getKey());
NodeInfo nodeInfo = nodesByName.computeIfAbsent(nodeName, name -> {
NodeInfo info = new NodeInfo(name);
info.setHost(member.getAddress().getHost());
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImplTest.java
index ec34e93e52e..d36ce91ee3a 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImplTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/AppNodesInfoLoaderImplTest.java
@@ -19,9 +19,9 @@
*/
package org.sonar.server.platform.monitoring.cluster;
-import com.hazelcast.core.Member;
-import com.hazelcast.core.MemberSelector;
-import com.hazelcast.nio.Address;
+import com.hazelcast.cluster.Address;
+import com.hazelcast.cluster.Member;
+import com.hazelcast.cluster.MemberSelector;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Collection;
@@ -41,7 +41,6 @@ import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
public class AppNodesInfoLoaderImplTest {
private static final InetAddress AN_ADDRESS = InetAddress.getLoopbackAddress();
@@ -49,8 +48,8 @@ public class AppNodesInfoLoaderImplTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- private HazelcastMember hzMember = mock(HazelcastMember.class);
- private AppNodesInfoLoaderImpl underTest = new AppNodesInfoLoaderImpl(hzMember);
+ private final HazelcastMember hzMember = mock(HazelcastMember.class);
+ private final AppNodesInfoLoaderImpl underTest = new AppNodesInfoLoaderImpl(hzMember);
@Test
public void load_info_from_all_nodes() throws Exception {
@@ -90,7 +89,7 @@ public class AppNodesInfoLoaderImplTest {
private Member newMember(String name) {
Member member = mock(Member.class, Mockito.RETURNS_MOCKS);
- when(member.getStringAttribute(HazelcastMember.Attribute.NODE_NAME.getKey())).thenReturn(name);
+ when(member.getAttribute(HazelcastMember.Attribute.NODE_NAME.getKey())).thenReturn(name);
when(member.getAddress()).thenReturn(new Address(AN_ADDRESS, 6789));
return member;
}