From fd6e8e2666d60d19cf5cc1036ca4db7fce26467d Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Mon, 4 Sep 2017 10:34:41 +0200 Subject: SONAR-9740 rename HazelcastClient#getConnectedClients to getMemberUuids which now return UUID of all members of the HZ cluster, both members and local clients to these member also rename #getClientUuid to getUuid --- .../java/org/sonar/ce/CeDistributedInformationImpl.java | 6 +++--- .../org/sonar/ce/CeDistributedInformationImplTest.java | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'server/sonar-ce/src') diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java index 96cfbb6fdf5..1f48d9323b5 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java @@ -45,7 +45,7 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S @Override public Set getWorkerUUIDs() { - Set connectedWorkerUUIDs = hazelcastClient.getConnectedClients(); + Set connectedWorkerUUIDs = hazelcastClient.getMemberUuids(); return getClusteredWorkerUUIDs().entrySet().stream() .filter(e -> connectedWorkerUUIDs.contains(e.getKey())) @@ -56,7 +56,7 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S @Override public void broadcastWorkerUUIDs() { - getClusteredWorkerUUIDs().put(hazelcastClient.getClientUUID(), ceCeWorkerFactory.getWorkerUUIDs()); + getClusteredWorkerUUIDs().put(hazelcastClient.getUUID(), ceCeWorkerFactory.getWorkerUUIDs()); } @Override @@ -72,7 +72,7 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S @Override public void stop() { // Removing the worker UUIDs - getClusteredWorkerUUIDs().remove(hazelcastClient.getClientUUID()); + getClusteredWorkerUUIDs().remove(hazelcastClient.getUUID()); } private Map> getClusteredWorkerUUIDs() { diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java index 782db8bc4a4..630de3cf30f 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java @@ -49,8 +49,8 @@ public class CeDistributedInformationImplTest { @Test public void getWorkerUUIDs_returns_union_of_workers_uuids_of_local_and_cluster_worker_uuids() { - when(hzClientWrapper.getClientUUID()).thenReturn(clientUUID1); - when(hzClientWrapper.getConnectedClients()).thenReturn(ImmutableSet.of(clientUUID1, clientUUID2, clientUUID3)); + when(hzClientWrapper.getUUID()).thenReturn(clientUUID1); + when(hzClientWrapper.getMemberUuids()).thenReturn(ImmutableSet.of(clientUUID1, clientUUID2, clientUUID3)); when(hzClientWrapper.getReplicatedMap(WORKER_UUIDS)).thenReturn(workerMap); CeDistributedInformation ceDistributedInformation = new CeDistributedInformationImpl(hzClientWrapper, mock(CeWorkerFactory.class)); @@ -59,8 +59,8 @@ public class CeDistributedInformationImplTest { @Test public void getWorkerUUIDs_must_filter_absent_client() { - when(hzClientWrapper.getClientUUID()).thenReturn(clientUUID1); - when(hzClientWrapper.getConnectedClients()).thenReturn(ImmutableSet.of(clientUUID1, clientUUID2)); + when(hzClientWrapper.getUUID()).thenReturn(clientUUID1); + when(hzClientWrapper.getMemberUuids()).thenReturn(ImmutableSet.of(clientUUID1, clientUUID2)); when(hzClientWrapper.getReplicatedMap(WORKER_UUIDS)).thenReturn(workerMap); CeDistributedInformation ceDistributedInformation = new CeDistributedInformationImpl(hzClientWrapper, mock(CeWorkerFactory.class)); @@ -74,8 +74,8 @@ public class CeDistributedInformationImplTest { connectedClients.add(clientUUID1); connectedClients.add(clientUUID2); - when(hzClientWrapper.getClientUUID()).thenReturn(clientUUID1); - when(hzClientWrapper.getConnectedClients()).thenReturn(connectedClients); + when(hzClientWrapper.getUUID()).thenReturn(clientUUID1); + when(hzClientWrapper.getMemberUuids()).thenReturn(connectedClients); when(hzClientWrapper.getReplicatedMap(WORKER_UUIDS)).thenReturn(modifiableWorkerMap); CeWorkerFactory ceWorkerFactory = mock(CeWorkerFactory.class); @@ -101,8 +101,8 @@ public class CeDistributedInformationImplTest { Map modifiableWorkerMap = new HashMap(); modifiableWorkerMap.putAll(workerMap); - when(hzClientWrapper.getClientUUID()).thenReturn(clientUUID1); - when(hzClientWrapper.getConnectedClients()).thenReturn(connectedClients); + when(hzClientWrapper.getUUID()).thenReturn(clientUUID1); + when(hzClientWrapper.getMemberUuids()).thenReturn(connectedClients); when(hzClientWrapper.getReplicatedMap(WORKER_UUIDS)).thenReturn(modifiableWorkerMap); CeDistributedInformationImpl ceDistributedInformation = new CeDistributedInformationImpl(hzClientWrapper, mock(CeWorkerFactory.class)); -- cgit v1.2.3