You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2018/03/19 16:49:22 UTC

[geode] branch develop updated: GEODE-4857: add interface methods to ClusterConfigurationService (#1637)

This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 694ee1d  GEODE-4857: add interface methods to ClusterConfigurationService (#1637)
694ee1d is described below

commit 694ee1dfab0aaf07824c2b3aecafbbc47dfbf45d
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Mon Mar 19 09:49:17 2018 -0700

    GEODE-4857: add interface methods to ClusterConfigurationService (#1637)
    
    * GEODE-4857: add interface methods to ClusterConfigurationService
---
 .../distributed/ClusterConfigurationService.java   | 150 +++++++++++++++++++++
 .../InternalClusterConfigurationService.java       |  19 +--
 .../internal/cache/configuration/RegionConfig.java |   7 +-
 .../cli/commands/CreateJndiBindingCommand.java     |   2 +-
 .../cli/commands/DestroyJndiBindingCommand.java    |   2 +-
 .../sanctioned-geode-core-serializables.txt        |   1 +
 .../InternalClusterConfigurationServiceTest.java   | 125 ++++++++++++++++-
 .../cli/commands/CreateJndiBindingCommandTest.java |  12 +-
 .../commands/DestroyJndiBindingCommandTest.java    |  14 +-
 9 files changed, 304 insertions(+), 28 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/ClusterConfigurationService.java
index b5a1352..a5d333e 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/ClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ClusterConfigurationService.java
@@ -17,8 +17,158 @@
 
 package org.apache.geode.distributed;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.UnaryOperator;
+
 import org.apache.geode.annotations.Experimental;
+import org.apache.geode.internal.cache.configuration.CacheConfig;
+import org.apache.geode.internal.cache.configuration.CacheElement;
+import org.apache.geode.internal.cache.configuration.RegionConfig;
+import org.apache.geode.lang.Identifiable;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 
 @Experimental
 public interface ClusterConfigurationService {
+
+  /**
+   * retrieves the configuration object of a member group
+   *
+   * @param group the member group name, if null, then "cluster" is assumed
+   * @param additionalBindClass custom element classes if needed
+   * @return the configuration object
+   */
+  CacheConfig getCacheConfig(String group, Class<? extends CacheElement>... additionalBindClass);
+
+  /**
+   * update the cluster configuration of a member group
+   *
+   * @param group the member group name, if null, then "cluster" is assumed
+   * @param mutator the change you want to apply to the configuration
+   * @param additionalBindClass custom element classes if needed
+   */
+  void updateCacheConfig(String group, UnaryOperator<CacheConfig> mutator,
+      Class<? extends CacheElement>... additionalBindClass);
+
+
+  default <T extends CacheElement> T getCustomCacheElement(String group, String id,
+      Class<T> classT) {
+    CacheConfig cacheConfig = getCacheConfig(group, classT);
+    return findCustomCacheElement(cacheConfig, id, classT);
+  }
+
+  default void saveCustomCacheElement(String group, CacheElement element) {
+    updateCacheConfig(group, cacheConfig -> {
+      CacheElement foundElement =
+          findCustomCacheElement(cacheConfig, element.getId(), element.getClass());
+      if (foundElement != null) {
+        cacheConfig.getCustomCacheElements().remove(foundElement);
+      }
+      cacheConfig.getCustomCacheElements().add(element);
+      return cacheConfig;
+    }, element.getClass());
+  }
+
+  default void deleteCustomCacheElement(String group, String id,
+      Class<? extends CacheElement> classT) {
+    updateCacheConfig(group, config -> {
+      CacheElement cacheElement = findCustomCacheElement(config, id, classT);
+      if (cacheElement == null) {
+        return null;
+      }
+      config.getCustomCacheElements().remove(cacheElement);
+      return config;
+    }, classT);
+  }
+
+  default <T extends CacheElement> T getCustomRegionElement(String group, String regionPath,
+      String id, Class<T> classT) {
+    CacheConfig cacheConfig = getCacheConfig(group, classT);
+    return findCustomRegionElement(cacheConfig, regionPath, id, classT);
+  }
+
+  default void saveCustomRegionElement(String group, String regionPath, CacheElement element) {
+    updateCacheConfig(group, cacheConfig -> {
+      RegionConfig regionConfig = findRegionConfiguration(cacheConfig, regionPath);
+      if (regionConfig == null) {
+        throw new EntityNotFoundException(
+            String.format("region %s does not exist in group %s", regionPath, group));
+      }
+
+      CacheElement oldElement =
+          findCustomRegionElement(cacheConfig, regionPath, element.getId(), element.getClass());
+
+      if (oldElement != null) {
+        regionConfig.getCustomRegionElements().remove(oldElement);
+      }
+      regionConfig.getCustomRegionElements().add(element);
+      return cacheConfig;
+    }, element.getClass());
+  }
+
+  default void deleteCustomRegionElement(String group, String regionPath, String id,
+      Class<? extends CacheElement> classT) {
+    updateCacheConfig(group, cacheConfig -> {
+      RegionConfig regionConfig = findRegionConfiguration(cacheConfig, regionPath);
+      if (regionConfig == null) {
+        throw new EntityNotFoundException(
+            String.format("region %s does not exist in group %s", regionPath, group));
+      }
+      CacheElement element = findCustomRegionElement(cacheConfig, regionPath, id, classT);
+      if (element == null) {
+        return null;
+      }
+      regionConfig.getCustomRegionElements().remove(element);
+      return cacheConfig;
+    }, classT);
+  }
+
+
+  default <T extends Identifiable<String>> T findIdentifiable(List<T> list, String id) {
+    return list.stream().filter(o -> o.getId().equals(id)).findFirst().orElse(null);
+  }
+
+  default RegionConfig findRegionConfiguration(CacheConfig cacheConfig, String regionPath) {
+    return findIdentifiable(cacheConfig.getRegion(), regionPath);
+  }
+
+  default <T extends CacheElement> List<T> findCustomCacheElements(CacheConfig cacheConfig,
+      Class<T> classT) {
+
+    List<T> newList = new ArrayList<>();
+    // streaming won't work here, because it's trying to cast element into CacheElement
+    for (Object element : cacheConfig.getCustomCacheElements()) {
+      if (classT.isInstance(element)) {
+        newList.add(classT.cast(element));
+      }
+    }
+    return newList;
+  }
+
+  default <T extends CacheElement> T findCustomCacheElement(CacheConfig cacheConfig,
+      String elementId, Class<T> classT) {
+    return findIdentifiable(findCustomCacheElements(cacheConfig, classT), elementId);
+  }
+
+  default <T extends CacheElement> List<T> findCustomRegionElements(CacheConfig cacheConfig,
+      String regionPath, Class<T> classT) {
+    List<T> newList = new ArrayList<>();
+    RegionConfig regionConfig = findRegionConfiguration(cacheConfig, regionPath);
+    if (regionConfig == null) {
+      return newList;
+    }
+
+    // streaming won't work here, because it's trying to cast element into CacheElement
+    for (Object element : regionConfig.getCustomRegionElements()) {
+      if (classT.isInstance(element)) {
+        newList.add(classT.cast(element));
+      }
+    }
+    return newList;
+  }
+
+  default <T extends CacheElement> T findCustomRegionElement(CacheConfig cacheConfig,
+      String regionPath, String elementId, Class<T> classT) {
+    return findIdentifiable(findCustomRegionElements(cacheConfig, regionPath, classT), elementId);
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
index 73e3b9f..127487c 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalClusterConfigurationService.java
@@ -93,7 +93,6 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
 import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.lang.Identifiable;
 import org.apache.geode.management.internal.beans.FileUploader;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.configuration.callbacks.ConfigurationChangeListener;
@@ -826,11 +825,11 @@ public class InternalClusterConfigurationService implements ClusterConfiguration
     return configDir;
   }
 
-  private Collection<Class> bindClasses = new ArrayList<>();
+  Collection<Class> bindClasses = new ArrayList<>();
   private Marshaller marshaller;
   private Unmarshaller unmarshaller;
 
-  private void initJaxbContext() {
+  void initJaxbContext() {
     try {
       JAXBContext jaxbContext =
           JAXBContext.newInstance(bindClasses.toArray(new Class[bindClasses.size()]));
@@ -867,13 +866,21 @@ public class InternalClusterConfigurationService implements ClusterConfiguration
     return unmarshaller;
   }
 
+  @Override
   public CacheConfig getCacheConfig(String group,
       Class<? extends CacheElement>... additionalBindClass) {
+    if (group == null) {
+      group = CLUSTER_CONFIG;
+    }
     return unMarshall(getConfiguration(group).getCacheXmlContent(), additionalBindClass);
   }
 
+  @Override
   public void updateCacheConfig(String group, UnaryOperator<CacheConfig> mutator,
-      Class... additionalBindClass) {
+      Class<? extends CacheElement>... additionalBindClass) {
+    if (group == null) {
+      group = CLUSTER_CONFIG;
+    }
     lockSharedConfiguration();
     try {
       CacheConfig cacheConfig = getCacheConfig(group, additionalBindClass);
@@ -890,10 +897,6 @@ public class InternalClusterConfigurationService implements ClusterConfiguration
     }
   }
 
-  public <T extends Identifiable<String>> T findElement(List<T> list, String id) {
-    return list.stream().filter(o -> o.getId().equals(id)).findFirst().orElse(null);
-  }
-
   String marshall(CacheConfig config, Class<? extends CacheElement>... additionalClass) {
     StringWriter sw = new StringWriter();
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/configuration/RegionConfig.java b/geode-core/src/main/java/org/apache/geode/internal/cache/configuration/RegionConfig.java
index 614c673..c81e3f0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/configuration/RegionConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/configuration/RegionConfig.java
@@ -147,7 +147,7 @@ import org.w3c.dom.Element;
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "region-type", namespace = "http://geode.apache.org/schema/cache",
     propOrder = {"regionAttributes", "index", "entry", "regionElements", "region"})
-public class RegionConfig {
+public class RegionConfig implements CacheElement {
 
   @XmlElement(name = "region-attributes", namespace = "http://geode.apache.org/schema/cache")
   protected List<RegionAttributesType> regionAttributes;
@@ -363,6 +363,11 @@ public class RegionConfig {
     this.refid = value;
   }
 
+  @Override
+  public String getId() {
+    return getName();
+  }
+
 
   /**
    * <p>
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java
index 6c0e04c..8f529d6 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java
@@ -152,7 +152,7 @@ public class CreateJndiBindingCommand extends GfshCommand {
     if (service != null) {
       CacheConfig cacheConfig = service.getCacheConfig("cluster");
       JndiBindingsType.JndiBinding existing =
-          service.findElement(cacheConfig.getJndiBindings(), jndiName);
+          service.findIdentifiable(cacheConfig.getJndiBindings(), jndiName);
       if (existing != null) {
         throw new EntityExistsException(
             CliStrings.format("Jndi binding with jndi-name \"{0}\" already exists.", jndiName),
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommand.java
index 3913381..a9b6415 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommand.java
@@ -59,7 +59,7 @@ public class DestroyJndiBindingCommand extends GfshCommand {
     if (service != null) {
       service.updateCacheConfig("cluster", cc -> {
         List<JndiBindingsType.JndiBinding> bindings = cc.getJndiBindings();
-        JndiBindingsType.JndiBinding binding = service.findElement(bindings, jndiName);
+        JndiBindingsType.JndiBinding binding = service.findIdentifiable(bindings, jndiName);
         if (binding == null) {
           throw new EntityNotFoundException(
               CliStrings.format("Jndi binding with jndi-name \"{0}\" does not exist.", jndiName),
diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index ea35091..f4abc02 100644
--- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -298,6 +298,7 @@ org/apache/geode/internal/cache/configuration/RegionAttributesDataPolicy,false,v
 org/apache/geode/internal/cache/configuration/RegionAttributesIndexUpdateType,false,value:java/lang/String
 org/apache/geode/internal/cache/configuration/RegionAttributesMirrorType,false,value:java/lang/String
 org/apache/geode/internal/cache/configuration/RegionAttributesScope,false,value:java/lang/String
+org/apache/geode/internal/cache/configuration/RegionConfig,false,entry:java/util/List,index:java/util/List,name:java/lang/String,refid:java/lang/String,region:java/util/List,regionAttributes:java/util/List,regionElements:java/util/List
 org/apache/geode/internal/cache/control/InternalResourceManager$ResourceType,false,id:int
 org/apache/geode/internal/cache/control/MemoryThresholds$MemoryState,false
 org/apache/geode/internal/cache/control/PartitionRebalanceDetailsImpl,true,5880667005758250156,bucketCreateBytes:long,bucketCreateTime:long,bucketCreatesCompleted:int,bucketRemoveBytes:long,bucketRemoveTime:long,bucketRemovesCompleted:int,bucketTransferBytes:long,bucketTransferTime:long,bucketTransfersCompleted:int,partitionMemberDetailsAfter:java/util/Set,partitionMemberDetailsBefore:java/util/Set,primaryTransferTime:long,primaryTransfersCompleted:int,time:long
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalClusterConfigurationServiceTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalClusterConfigurationServiceTest.java
index 1cf6062..e4d772c 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalClusterConfigurationServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalClusterConfigurationServiceTest.java
@@ -18,6 +18,7 @@
 package org.apache.geode.distributed.internal;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
@@ -38,6 +39,7 @@ import org.apache.geode.internal.cache.configuration.CacheConfig;
 import org.apache.geode.internal.cache.configuration.CacheElement;
 import org.apache.geode.internal.cache.configuration.JndiBindingsType;
 import org.apache.geode.internal.cache.configuration.RegionConfig;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 import org.apache.geode.management.internal.configuration.domain.Configuration;
 import org.apache.geode.test.junit.categories.UnitTest;
 
@@ -46,17 +48,22 @@ import org.apache.geode.test.junit.categories.UnitTest;
 public class InternalClusterConfigurationServiceTest {
   private String xml;
   private CacheConfig unmarshalled;
-  private InternalClusterConfigurationService service;
+  private InternalClusterConfigurationService service, service2;
   private Configuration configuration;
 
   @Before
   public void setUp() throws Exception {
     service = spy(InternalClusterConfigurationService.class);
+    service2 = spy(InternalClusterConfigurationService.class);
     configuration = new Configuration("cluster");
     doReturn(configuration).when(service).getConfiguration(any());
+    doReturn(configuration).when(service2).getConfiguration(any());
     doReturn(mock(Region.class)).when(service).getConfigurationRegion();
+    doReturn(mock(Region.class)).when(service2).getConfigurationRegion();
     doReturn(true).when(service).lockSharedConfiguration();
+    doReturn(true).when(service2).lockSharedConfiguration();
     doNothing().when(service).unlockSharedConfiguration();
+    doNothing().when(service2).unlockSharedConfiguration();
   }
 
   @Test
@@ -111,6 +118,38 @@ public class InternalClusterConfigurationServiceTest {
   }
 
   @Test
+  public void xmlWithCustomElementsCanBeUnMarshalledByAnotherService() {
+    service.saveCustomCacheElement("cluster", new ElementOne("one"));
+    service.saveCustomCacheElement("cluster", new ElementTwo("two"));
+
+    String prettyXml = configuration.getCacheXmlContent();
+    System.out.println(prettyXml);
+
+    // the xml is sent to another locator, and can interpreted ocrrectly
+    service2.updateCacheConfig("cluster", cc -> {
+      return cc;
+    });
+
+    ElementOne elementOne = service2.getCustomCacheElement("cluster", "one", ElementOne.class);
+    assertThat(elementOne.getId()).isEqualTo("one");
+
+    String uglyXml = configuration.getCacheXmlContent();
+    System.out.println(uglyXml);
+    assertThat(uglyXml).isNotEqualTo(prettyXml);
+
+    // the xml can be unmarshalled correctly by the first locator
+    CacheConfig cacheConfig = service.getCacheConfig("cluster");
+    service.updateCacheConfig("cluster", cc -> {
+      return cc;
+    });
+    assertThat(cacheConfig.getCustomCacheElements()).hasSize(2);
+    assertThat(cacheConfig.getCustomCacheElements().get(0)).isInstanceOf(ElementOne.class);
+    assertThat(cacheConfig.getCustomCacheElements().get(1)).isInstanceOf(ElementTwo.class);
+
+    assertThat(configuration.getCacheXmlContent()).isEqualTo(prettyXml);
+  }
+
+  @Test
   public void updateRegionConfig() {
     service.updateCacheConfig("cluster", cacheConfig -> {
       RegionConfig regionConfig = new RegionConfig();
@@ -161,6 +200,82 @@ public class InternalClusterConfigurationServiceTest {
         .contains("config-property-name>test</config-property-name>");
   }
 
+  @Test
+  public void addCustomCacheElement() {
+    ElementOne customOne = new ElementOne("testOne");
+    service.saveCustomCacheElement("cluster", customOne);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("custom-one>");
+
+    ElementTwo customTwo = new ElementTwo("testTwo");
+    service.saveCustomCacheElement("cluster", customTwo);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("custom-one>");
+    assertThat(configuration.getCacheXmlContent()).contains("custom-two>");
+  }
+
+  @Test
+  public void updateCustomCacheElement() {
+    ElementOne customOne = new ElementOne("testOne");
+    service.saveCustomCacheElement("cluster", customOne);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("custom-one>");
+    assertThat(configuration.getCacheXmlContent()).contains("<id>testOne</id>");
+    assertThat(configuration.getCacheXmlContent()).doesNotContain("<value>");
+
+    customOne = service.getCustomCacheElement("cluster", "testOne", ElementOne.class);
+    customOne.setValue("valueOne");
+    service.saveCustomCacheElement("cluster", customOne);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("custom-one>");
+    assertThat(configuration.getCacheXmlContent()).contains("<id>testOne</id>");
+    assertThat(configuration.getCacheXmlContent()).contains("<value>valueOne</value>");
+  }
+
+  @Test
+  public void deleteCustomCacheElement() {
+    ElementOne customOne = new ElementOne("testOne");
+    service.saveCustomCacheElement("cluster", customOne);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("custom-one>");
+
+    service.deleteCustomCacheElement("cluster", "testOne", ElementOne.class);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).doesNotContain("custom-one>");
+  }
+
+  @Test
+  public void updateCustomRegionElement() {
+    // start with a cache.xml that has region info
+    service.updateCacheConfig("cluster", cacheConfig -> {
+      setBasicValues(cacheConfig);
+      return cacheConfig;
+    });
+
+    ElementOne one = new ElementOne("elementOne");
+    one.setValue("valueOne");
+
+    assertThatThrownBy(() -> service.saveCustomRegionElement("cluster", "noSuchRegion", one))
+        .isInstanceOf(EntityNotFoundException.class)
+        .hasMessageContaining("region noSuchRegion does not exist in group cluster");
+
+    service.saveCustomRegionElement("cluster", "testRegion", one);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).contains("region name=\"testRegion\"");
+    assertThat(configuration.getCacheXmlContent())
+        .containsPattern("\\w*:custom-one\\W*\\w*:region");
+
+    ElementOne retrieved =
+        service.getCustomRegionElement("cluster", "testRegion", "elementOne", ElementOne.class);
+    assertThat(retrieved.getId()).isEqualTo("elementOne");
+    assertThat(retrieved.getValue()).isEqualTo("valueOne");
+
+    service.deleteCustomRegionElement("cluster", "testRegion", "elementOne", ElementOne.class);
+    System.out.println(configuration.getCacheXmlContent());
+    assertThat(configuration.getCacheXmlContent()).doesNotContain("custom-one>");
+  }
+
+
   @XmlAccessorType(XmlAccessType.FIELD)
   @XmlType(name = "", propOrder = {"id", "value"})
   @XmlRootElement(name = "custom-one", namespace = "http://geode.apache.org/schema/CustomOne")
@@ -178,8 +293,8 @@ public class InternalClusterConfigurationServiceTest {
       this.value = value;
     }
 
-    public ElementOne(String value) {
-      this.id = value;
+    public ElementOne(String id) {
+      this.id = id;
     }
 
     public String getId() {
@@ -208,8 +323,8 @@ public class InternalClusterConfigurationServiceTest {
       this.value = value;
     }
 
-    public ElementTwo(String value) {
-      this.id = value;
+    public ElementTwo(String id) {
+      this.id = id;
     }
 
     public String getId() {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandTest.java
index f7fd35f..e7dec79 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandTest.java
@@ -105,7 +105,7 @@ public class CreateJndiBindingCommandTest {
 
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(existingBinding).when(clusterConfigService).findElement(any(), any());
+    doReturn(existingBinding).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND + " --type=SIMPLE --name=name --jdbc-driver-class=driver --connection-url=url")
@@ -122,7 +122,7 @@ public class CreateJndiBindingCommandTest {
 
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(existingBinding).when(clusterConfigService).findElement(any(), any());
+    doReturn(existingBinding).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND
@@ -140,7 +140,7 @@ public class CreateJndiBindingCommandTest {
 
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(existingBinding).when(clusterConfigService).findElement(any(), any());
+    doReturn(existingBinding).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND
@@ -157,7 +157,7 @@ public class CreateJndiBindingCommandTest {
 
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(existingBinding).when(clusterConfigService).findElement(any(), any());
+    doReturn(existingBinding).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND
@@ -185,7 +185,7 @@ public class CreateJndiBindingCommandTest {
     doReturn(Collections.emptySet()).when(command).findMembers(any(), any());
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(null).when(clusterConfigService).findElement(any(), any());
+    doReturn(null).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND + " --type=SIMPLE --name=name --jdbc-driver-class=driver --connection-url=url")
@@ -251,7 +251,7 @@ public class CreateJndiBindingCommandTest {
     doReturn(clusterConfigService).when(command).getSharedConfiguration();
     doReturn(results).when(command).executeAndGetFunctionResult(any(), any(), any());
     doReturn(cacheConfig).when(clusterConfigService).getCacheConfig(any());
-    doReturn(null).when(clusterConfigService).findElement(any(), any());
+    doReturn(null).when(clusterConfigService).findIdentifiable(any(), any());
 
     gfsh.executeAndAssertThat(command,
         COMMAND
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandTest.java
index 8d517f7..c67d1f3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandTest.java
@@ -83,28 +83,28 @@ public class DestroyJndiBindingCommandTest {
 
   @Test
   public void returnsErrorIfBindingDoesNotExistAndIfExistsUnspecified() {
-    when(ccService.findElement(any(), any())).thenReturn(null);
+    when(ccService.findIdentifiable(any(), any())).thenReturn(null);
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name").statusIsError()
         .containsOutput("does not exist.");
   }
 
   @Test
   public void skipsIfBindingDoesNotExistAndIfExistsSpecified() {
-    when(ccService.findElement(any(), any())).thenReturn(null);
+    when(ccService.findIdentifiable(any(), any())).thenReturn(null);
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name --if-exists").statusIsSuccess()
         .containsOutput("does not exist.");
   }
 
   @Test
   public void skipsIfBindingDoesNotExistAndIfExistsSpecifiedTrue() {
-    when(ccService.findElement(any(), any())).thenReturn(null);
+    when(ccService.findIdentifiable(any(), any())).thenReturn(null);
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name --if-exists=true").statusIsSuccess()
         .containsOutput("does not exist.");
   }
 
   @Test
   public void returnsErrorIfBindingDoesNotExistAndIfExistsSpecifiedFalse() {
-    when(ccService.findElement(any(), any())).thenReturn(null);
+    when(ccService.findIdentifiable(any(), any())).thenReturn(null);
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name --if-exists=false").statusIsError()
         .containsOutput("does not exist.");
   }
@@ -121,7 +121,8 @@ public class DestroyJndiBindingCommandTest {
   @Test
   public void whenNoMembersFoundAndClusterConfigRunningThenUpdateClusterConfig() {
     doReturn(Collections.emptySet()).when(command).findMembers(any(), any());
-    when(ccService.findElement(any(), any())).thenReturn(mock(JndiBindingsType.JndiBinding.class));
+    when(ccService.findIdentifiable(any(), any()))
+        .thenReturn(mock(JndiBindingsType.JndiBinding.class));
 
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name").statusIsSuccess()
         .containsOutput(
@@ -176,7 +177,8 @@ public class DestroyJndiBindingCommandTest {
 
     doReturn(members).when(command).findMembers(any(), any());
     doReturn(results).when(command).executeAndGetFunctionResult(any(), any(), any());
-    when(ccService.findElement(any(), any())).thenReturn(mock(JndiBindingsType.JndiBinding.class));
+    when(ccService.findIdentifiable(any(), any()))
+        .thenReturn(mock(JndiBindingsType.JndiBinding.class));
 
     gfsh.executeAndAssertThat(command, COMMAND + " --name=name").statusIsSuccess()
         .tableHasColumnOnlyWithValues("Member", "server1")

-- 
To stop receiving notification emails like this one, please contact
jinmeiliao@apache.org.