diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceService.java index 692d44f704ac..cea1c444895b 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceService.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceService.java @@ -66,7 +66,6 @@ import org.apache.geode.distributed.ConfigurationPersistenceService; import org.apache.geode.distributed.DistributedLockService; import org.apache.geode.distributed.DistributedMember; -import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.distributed.internal.locks.DLockService; import org.apache.geode.internal.JarDeployer; import org.apache.geode.internal.cache.ClusterConfigurationLoader; @@ -129,7 +128,8 @@ public class InternalConfigurationPersistenceService implements ConfigurationPer public InternalConfigurationPersistenceService(InternalCache cache, Path workingDirectory, JAXBService jaxbService) { this(cache, - sharedConfigLockService(cache.getDistributedSystem()), + DLockService.getOrCreateService(SHARED_CONFIG_LOCK_SERVICE_NAME, + cache.getInternalDistributedSystem()), jaxbService, workingDirectory.resolve(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME), workingDirectory @@ -153,24 +153,6 @@ public InternalConfigurationPersistenceService(JAXBService jaxbService) { this.jaxbService = jaxbService; } - - /** - * Gets or creates (if not created) shared configuration lock service - */ - private static DistributedLockService sharedConfigLockService(DistributedSystem ds) { - DistributedLockService sharedConfigDls = - DLockService.getServiceNamed(SHARED_CONFIG_LOCK_SERVICE_NAME); - try { - if (sharedConfigDls == null) { - sharedConfigDls = DLockService.create(SHARED_CONFIG_LOCK_SERVICE_NAME, - (InternalDistributedSystem) ds, true, true); - } - } catch (IllegalArgumentException ignore) { - return DLockService.getServiceNamed(SHARED_CONFIG_LOCK_SERVICE_NAME); - } - return sharedConfigDls; - } - public JAXBService getJaxbService() { return jaxbService; } diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java index bd0c20d9549b..724bb2bb8140 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java @@ -2663,6 +2663,18 @@ public int getSerialNumber() { // ------------------------------------------------------------------------- // External API methods // ------------------------------------------------------------------------- + public static DistributedLockService getOrCreateService(String serviceName, + InternalDistributedSystem ds) { + DistributedLockService cmsLockService = DLockService.getServiceNamed(serviceName); + try { + if (cmsLockService == null) { + cmsLockService = DLockService.create(serviceName, ds, true, true); + } + } catch (IllegalArgumentException ignore) { + return DLockService.getServiceNamed(serviceName); + } + return cmsLockService; + } /** * @see org.apache.geode.distributed.DistributedLockService#getServiceNamed(String) diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/BaseManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/BaseManagementService.java index c3f538ff78b8..dc58e7c779e0 100755 --- a/geode-core/src/main/java/org/apache/geode/management/internal/BaseManagementService.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/BaseManagementService.java @@ -94,6 +94,13 @@ public static void setManagementService(InternalCacheForClientAccess cache, } } + @VisibleForTesting + public static void clearManagementService(InternalCacheForClientAccess cache) { + synchronized (instances) { + instances.remove(cache); + } + } + public static ManagementService getExistingManagementService(InternalCache cache) { synchronized (instances) { BaseManagementService service = instances.get(cache.getCacheForProcessingClientRequests()); diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java index 2235b9b5b619..9ff83f8b884e 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java @@ -47,8 +47,10 @@ import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionService; import org.apache.geode.cache.execute.ResultCollector; +import org.apache.geode.distributed.DistributedLockService; import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.internal.InternalConfigurationPersistenceService; +import org.apache.geode.distributed.internal.locks.DLockService; import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.execute.AbstractExecution; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -105,7 +107,13 @@ import org.apache.geode.management.runtime.OperationResult; import org.apache.geode.management.runtime.RuntimeInfo; +/** + * each locator will have one instance of this running if enabled + */ public class LocatorClusterManagementService implements ClusterManagementService { + @VisibleForTesting + // the dlock service name used by the CMS + static final String CMS_DLOCK_SERVICE_NAME = "CMS_DLOCK_SERVICE"; private static final Logger logger = LogService.getLogger(); private final InternalConfigurationPersistenceService persistenceService; private final Map managers; @@ -114,6 +122,7 @@ public class LocatorClusterManagementService implements ClusterManagementService private final MemberValidator memberValidator; private final CommonConfigurationValidator commonValidator; private final InternalCache cache; + private DistributedLockService cmsDlockService; public LocatorClusterManagementService(InternalCache cache, InternalConfigurationPersistenceService persistenceService) { @@ -154,6 +163,25 @@ public LocatorClusterManagementService( this.operationManager = operationManager; } + @VisibleForTesting + // synchronized because cmsDlockService is lazily initialized + synchronized DistributedLockService getCmsDlockService() { + if (cmsDlockService == null) { + cmsDlockService = + DLockService.getOrCreateService(CMS_DLOCK_SERVICE_NAME, + cache.getInternalDistributedSystem()); + } + return cmsDlockService; + } + + private boolean lockCMS() { + return getCmsDlockService().lock(CMS_DLOCK_SERVICE_NAME, -1, -1); + } + + private void unlockCMS() { + getCmsDlockService().unlock(CMS_DLOCK_SERVICE_NAME); + } + @Override public > ClusterManagementRealizationResult create(T config) { // validate that user used the correct config object type @@ -164,77 +192,82 @@ public > ClusterManagementRealizationResult c "Cluster configuration service needs to be enabled.")); } + lockCMS(); try { - // first validate common attributes of all configuration object - commonValidator.validate(CacheElementOperation.CREATE, config); + try { + // first validate common attributes of all configuration object + commonValidator.validate(CacheElementOperation.CREATE, config); - ConfigurationValidator validator = validators.get(config.getClass()); - if (validator != null) { - validator.validate(CacheElementOperation.CREATE, config); - } + ConfigurationValidator validator = validators.get(config.getClass()); + if (validator != null) { + validator.validate(CacheElementOperation.CREATE, config); + } - // check if this config already exists - if (configurationManager instanceof CacheConfigurationManager) { - memberValidator.validateCreate(config, (CacheConfigurationManager) configurationManager); + // check if this config already exists + if (configurationManager instanceof CacheConfigurationManager) { + memberValidator.validateCreate(config, (CacheConfigurationManager) configurationManager); + } + } catch (EntityExistsException e) { + raise(StatusCode.ENTITY_EXISTS, e); + } catch (IllegalArgumentException e) { + raise(StatusCode.ILLEGAL_ARGUMENT, e); } - } catch (EntityExistsException e) { - raise(StatusCode.ENTITY_EXISTS, e); - } catch (IllegalArgumentException e) { - raise(StatusCode.ILLEGAL_ARGUMENT, e); - } - // find the targeted members - Set groups = new HashSet<>(); - Set targetedMembers; - if (config instanceof RegionScoped) { - String regionName = ((RegionScoped) config).getRegionName(); - groups = memberValidator.findGroups(regionName); - if (groups.isEmpty()) { - raise(StatusCode.ENTITY_NOT_FOUND, "Region provided does not exist: " + regionName); + // find the targeted members + Set groups = new HashSet<>(); + Set targetedMembers; + if (config instanceof RegionScoped) { + String regionName = ((RegionScoped) config).getRegionName(); + groups = memberValidator.findGroups(regionName); + if (groups.isEmpty()) { + raise(StatusCode.ENTITY_NOT_FOUND, "Region provided does not exist: " + regionName); + } + targetedMembers = memberValidator.findServers(groups.toArray(new String[0])); + } else { + final String groupName = AbstractConfiguration.getGroupName(config.getGroup()); + groups.add(groupName); + targetedMembers = memberValidator.findServers(groupName); } - targetedMembers = memberValidator.findServers(groups.toArray(new String[0])); - } else { - final String groupName = AbstractConfiguration.getGroupName(config.getGroup()); - groups.add(groupName); - targetedMembers = memberValidator.findServers(groupName); - } - ClusterManagementRealizationResult result = new ClusterManagementRealizationResult(); + ClusterManagementRealizationResult result = new ClusterManagementRealizationResult(); - // execute function on all targeted members - List functionResults = executeAndGetFunctionResult( - new CacheRealizationFunction(), - config, CacheElementOperation.CREATE, - targetedMembers); + // execute function on all targeted members + List functionResults = executeAndGetFunctionResult( + new CacheRealizationFunction(), + config, CacheElementOperation.CREATE, + targetedMembers); - functionResults.forEach(result::addMemberStatus); + functionResults.forEach(result::addMemberStatus); - // if any false result is added to the member list - if (result.getStatusCode() != StatusCode.OK) { - result.setStatus(StatusCode.ERROR, "Failed to create on all members."); - return assertSuccessful(result); - } + // if any false result is added to the member list + if (result.getStatusCode() != StatusCode.OK) { + result.setStatus(StatusCode.ERROR, "Failed to create on all members."); + return assertSuccessful(result); + } - // persist configuration in cache config - List updatedGroups = new ArrayList<>(); - List failedGroups = new ArrayList<>(); - for (String groupName : groups) { - try { - configurationManager.add(config, groupName); - updatedGroups.add(groupName); - } catch (Exception e) { - logger.error(e.getMessage(), e); - failedGroups.add(groupName); + // persist configuration in cache config + List updatedGroups = new ArrayList<>(); + List failedGroups = new ArrayList<>(); + for (String groupName : groups) { + try { + configurationManager.add(config, groupName); + updatedGroups.add(groupName); + } catch (Exception e) { + logger.error(e.getMessage(), e); + failedGroups.add(groupName); + } } - } - setResultStatus(result, updatedGroups, failedGroups); + setResultStatus(result, updatedGroups, failedGroups); - // add the config object which includes the HATEOAS information of the element created - if (result.isSuccessful()) { - result.setLinks(config.getLinks()); + // add the config object which includes the HATEOAS information of the element created + if (result.isSuccessful()) { + result.setLinks(config.getLinks()); + } + return assertSuccessful(result); + } finally { + unlockCMS(); } - return assertSuccessful(result); } @VisibleForTesting @@ -278,56 +311,61 @@ public > ClusterManagementRealizationResult d "Cluster configuration service needs to be enabled.")); } + lockCMS(); try { - // first validate common attributes of all configuration object - commonValidator.validate(CacheElementOperation.DELETE, config); + try { + // first validate common attributes of all configuration object + commonValidator.validate(CacheElementOperation.DELETE, config); - ConfigurationValidator validator = validators.get(config.getClass()); - if (validator != null) { - validator.validate(CacheElementOperation.DELETE, config); + ConfigurationValidator validator = validators.get(config.getClass()); + if (validator != null) { + validator.validate(CacheElementOperation.DELETE, config); + } + } catch (IllegalArgumentException e) { + raise(StatusCode.ILLEGAL_ARGUMENT, e); } - } catch (IllegalArgumentException e) { - raise(StatusCode.ILLEGAL_ARGUMENT, e); - } - String[] groupsWithThisElement = - memberValidator.findGroupsWithThisElement(config, configurationManager); - if (groupsWithThisElement.length == 0) { - raise(StatusCode.ENTITY_NOT_FOUND, - config.getClass().getSimpleName() + " '" + config.getId() + "' does not exist."); - } + String[] groupsWithThisElement = + memberValidator.findGroupsWithThisElement(config, configurationManager); + if (groupsWithThisElement.length == 0) { + raise(StatusCode.ENTITY_NOT_FOUND, + config.getClass().getSimpleName() + " '" + config.getId() + "' does not exist."); + } - // execute function on all members - ClusterManagementRealizationResult result = new ClusterManagementRealizationResult(); + // execute function on all members + ClusterManagementRealizationResult result = new ClusterManagementRealizationResult(); - List functionResults = executeAndGetFunctionResult( - new CacheRealizationFunction(), - config, CacheElementOperation.DELETE, - memberValidator.findServers(groupsWithThisElement)); - functionResults.forEach(result::addMemberStatus); + List functionResults = executeAndGetFunctionResult( + new CacheRealizationFunction(), + config, CacheElementOperation.DELETE, + memberValidator.findServers(groupsWithThisElement)); + functionResults.forEach(result::addMemberStatus); - // if any false result is added to the member list - if (result.getStatusCode() != StatusCode.OK) { - result.setStatus(StatusCode.ERROR, "Failed to delete on all members."); - return result; - } + // if any false result is added to the member list + if (result.getStatusCode() != StatusCode.OK) { + result.setStatus(StatusCode.ERROR, "Failed to delete on all members."); + return result; + } - // persist configuration in cache config - List updatedGroups = new ArrayList<>(); - List failedGroups = new ArrayList<>(); - for (String finalGroup : groupsWithThisElement) { - try { - configurationManager.delete(config, finalGroup); - updatedGroups.add(finalGroup); - } catch (Exception e) { - logger.error(e.getMessage(), e); - failedGroups.add(finalGroup); + // persist configuration in cache config + List updatedGroups = new ArrayList<>(); + List failedGroups = new ArrayList<>(); + for (String finalGroup : groupsWithThisElement) { + try { + configurationManager.delete(config, finalGroup); + updatedGroups.add(finalGroup); + } catch (Exception e) { + logger.error(e.getMessage(), e); + failedGroups.add(finalGroup); + } } - } - setResultStatus(result, updatedGroups, failedGroups); + setResultStatus(result, updatedGroups, failedGroups); - return assertSuccessful(result); + return assertSuccessful(result); + } finally { + unlockCMS(); + } } @Override diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorClusterManagementServiceIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java similarity index 85% rename from geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorClusterManagementServiceIntegrationTest.java rename to geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java index 0e0226ee6606..fd678c805e8e 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/InternalLocatorClusterManagementServiceIntegrationTest.java +++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalLocatorTest.java @@ -11,8 +11,8 @@ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. - * */ + package org.apache.geode.distributed.internal; import static org.mockito.ArgumentMatchers.any; @@ -28,6 +28,7 @@ import java.util.Optional; import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.apache.geode.cache.RegionShortcut; @@ -40,17 +41,46 @@ import org.apache.geode.management.internal.AgentUtil; import org.apache.geode.management.internal.BaseManagementService; -public class InternalLocatorClusterManagementServiceIntegrationTest { - +public class InternalLocatorTest { private InternalLocator internalLocator; // the instance under test - private DistributionConfigImpl distributionConfig = mock(DistributionConfigImpl.class); - private InternalCacheForClientAccess cache = mock(InternalCacheForClientAccess.class); - private BaseManagementService managementService = mock(BaseManagementService.class); - private AgentUtil agentUtil = mock(AgentUtil.class); - private HttpService httpService = mock(HttpService.class); + private DistributionConfigImpl distributionConfig; + private InternalCacheForClientAccess cache; + private BaseManagementService managementService; + private AgentUtil agentUtil; + private HttpService httpService; + + @Before + public void setup() throws URISyntaxException { + distributionConfig = mock(DistributionConfigImpl.class); + cache = mock(InternalCacheForClientAccess.class); + managementService = mock(BaseManagementService.class); + agentUtil = mock(AgentUtil.class); + httpService = mock(HttpService.class); + InternalRegionFactory regionFactory = mock(InternalRegionFactory.class); + LoggingSession loggingSession = mock(LoggingSession.class); + URI uri = new URI("file", "/management.war", null); + + when(distributionConfig.getJmxManager()).thenReturn(true); + when(distributionConfig.getJmxManagerPort()) + .thenReturn(AvailablePortHelper.getRandomAvailableTCPPort()); + when(distributionConfig.getLocators()).thenReturn(""); + when(distributionConfig.getSecurableCommunicationChannels()) + .thenReturn(new SecurableCommunicationChannel[] {}); + when(distributionConfig.getSecurityAuthTokenEnabledComponents()).thenReturn(new String[] {}); + when(cache.createInternalRegionFactory(RegionShortcut.REPLICATE)).thenReturn(regionFactory); + when(cache.getOptionalService(HttpService.class)) + .thenReturn(Optional.of(httpService)); + when(cache.getCacheForProcessingClientRequests()).thenReturn(cache); + when(agentUtil.findWarLocation("geode-web-management")).thenReturn(uri); + BaseManagementService.setManagementService(cache, managementService); + + internalLocator = new InternalLocator(0, loggingSession, null, null, null, null, + null, null, distributionConfig, null); + } @After public void tearDown() { + BaseManagementService.clearManagementService(cache); if (internalLocator != null) { internalLocator.stop(); } @@ -59,10 +89,7 @@ public void tearDown() { @Test public void startClusterManagementServiceWithRestServiceEnabledInvokesStartManager() throws Exception { - createInternalLocator(); - setupForStartClusterManagementService(); when(distributionConfig.getEnableManagementRestService()).thenReturn(true); - internalLocator.startClusterManagementService(cache, agentUtil); verify(managementService).startManager(); @@ -72,8 +99,6 @@ public void startClusterManagementServiceWithRestServiceEnabledInvokesStartManag @Test public void startClusterManagementServiceWithRunningManagerNeverInvokesStartManager() throws Exception { - createInternalLocator(); - setupForStartClusterManagementService(); when(distributionConfig.getEnableManagementRestService()).thenReturn(true); when(managementService.isManager()).thenReturn(true); @@ -87,10 +112,7 @@ public void startClusterManagementServiceWithRunningManagerNeverInvokesStartMana @Test public void startClusterManagementServiceWithRestServiceDisabledNeverInvokesStartManager() throws Exception { - createInternalLocator(); - setupForStartClusterManagementService(); when(distributionConfig.getEnableManagementRestService()).thenReturn(false); - internalLocator.startClusterManagementService(cache, agentUtil); verify(distributionConfig).getEnableManagementRestService(); @@ -101,8 +123,6 @@ public void startClusterManagementServiceWithRestServiceDisabledNeverInvokesStar @Test public void startClusterManagementServiceWithRestServiceEnabledDoesNotThrowWhenStartManagerThrows() throws Exception { - createInternalLocator(); - setupForStartClusterManagementService(); when(distributionConfig.getEnableManagementRestService()).thenReturn(true); RuntimeException startManagerEx = new RuntimeException("startManager failed"); doThrow(startManagerEx).when(managementService).startManager(); @@ -113,28 +133,4 @@ public void startClusterManagementServiceWithRestServiceEnabledDoesNotThrowWhenS verify(httpService, never()).addWebApplication(eq("/management"), any(), any()); } - private void createInternalLocator() { - LoggingSession loggingSession = mock(LoggingSession.class); - when(distributionConfig.getJmxManager()).thenReturn(true); - when(distributionConfig.getJmxManagerPort()) - .thenReturn(AvailablePortHelper.getRandomAvailableTCPPort()); - when(distributionConfig.getLocators()).thenReturn(""); - when(distributionConfig.getSecurableCommunicationChannels()) - .thenReturn(new SecurableCommunicationChannel[] {}); - when(distributionConfig.getSecurityAuthTokenEnabledComponents()).thenReturn(new String[] {}); - internalLocator = new InternalLocator(0, loggingSession, null, null, null, null, - null, null, distributionConfig, null); - } - - private void setupForStartClusterManagementService() throws URISyntaxException { - InternalRegionFactory regionFactory = mock(InternalRegionFactory.class); - when(cache.createInternalRegionFactory(RegionShortcut.REPLICATE)).thenReturn(regionFactory); - when(cache.getOptionalService(HttpService.class)) - .thenReturn(Optional.of(httpService)); - when(cache.getCacheForProcessingClientRequests()).thenReturn(cache); - BaseManagementService.setManagementService(cache, managementService); - URI uri = new URI("file", "/management.war", null); - when(agentUtil.findWarLocation("geode-web-management")).thenReturn(uri); - } - } diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java index 5a6f543feebe..451bbbb9c669 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java @@ -50,6 +50,7 @@ import org.apache.geode.cache.configuration.CacheConfig; import org.apache.geode.cache.configuration.GatewayReceiverConfig; import org.apache.geode.cache.configuration.RegionConfig; +import org.apache.geode.distributed.DistributedLockService; import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.internal.InternalConfigurationPersistenceService; import org.apache.geode.internal.cache.InternalCache; @@ -101,6 +102,7 @@ public class LocatorClusterManagementServiceTest { private CacheConfigurationManager regionManager; private MemberValidator memberValidator; private RebalanceOperation rebalanceOperation; + private DistributedLockService dLockService; @Before public void before() throws Exception { @@ -125,9 +127,12 @@ public void before() throws Exception { doReturn(true).when(persistenceService).lockSharedConfiguration(); doNothing().when(persistenceService).unlockSharedConfiguration(); operationManager = mock(OperationManager.class); + dLockService = mock(DistributedLockService.class); + service = spy(new LocatorClusterManagementService(cache, persistenceService, managers, validators, memberValidator, cacheElementValidator, operationManager)); + doReturn(dLockService).when(service).getCmsDlockService(); regionConfig = new Region(); regionConfig.setName("region1"); @@ -135,6 +140,28 @@ public void before() throws Exception { rebalanceOperation = new RebalanceOperation(); } + @Test + public void lockAndUnlockCalledAtCreateWithException() { + try { + service.create(regionConfig); + } catch (Exception ignore) { + } + + verify(dLockService).lock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME, -1, -1); + verify(dLockService).unlock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME); + } + + @Test + public void lockAndUnlockCalledAtDeleteWithException() { + try { + service.delete(regionConfig); + } catch (Exception ignore) { + } + + verify(dLockService).lock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME, -1, -1); + verify(dLockService).unlock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME); + } + @Test public void create_persistenceIsNull() { org.apache.geode.cache.Region region = @@ -209,6 +236,8 @@ public void create_succeedsOnAllMembers() { assertThat(result.isSuccessful()).isTrue(); assertThat(cacheConfig.getRegions()).hasSize(1); + verify(dLockService).lock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME, -1, -1); + verify(dLockService).unlock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME); } @Test @@ -345,6 +374,8 @@ public void delete_succeedsOnAllMembers() { assertThat(result.isSuccessful()).isTrue(); assertThat(config.getRegions()).isEmpty(); + verify(dLockService).lock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME, -1, -1); + verify(dLockService).unlock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME); } @Test