geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [2/4] geode git commit: GEODE-2261: do not use remote function calls to update the shared configuration
Date Mon, 09 Jan 2017 18:18:02 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
index cd8500a..b301b80 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
@@ -83,7 +83,10 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
         "import cluster-configuration --zip-file-name=" + EXPORTED_CLUSTER_CONFIG_PATH);
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
-    // TODO: For [GEODE-2229] we will want to assert that a backup is created
+    // Make sure that a backup of the old clusterConfig was created
+    assertThat(locator.getWorkingDir().listFiles())
+        .filteredOn((File file) -> file.getName().contains("cluster_config")).hasSize(2);
+
     CONFIG_FROM_ZIP.verify(locator);
 
     // start server1 with no group
@@ -102,12 +105,10 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
   }
 
   @Test
-  @Category(FlakyTest.class) // remove after GEODE-2261 is implemented
   public void testImportWithMultipleLocators() throws Exception {
     locatorProps.setProperty(LOCATORS, "localhost[" + locator.getPort() + "]");
     Locator locator1 = lsRule.startLocatorVM(1, locatorProps);
 
-
     locatorProps.setProperty(LOCATORS,
         "localhost[" + locator.getPort() + "],localhost[" + locator1.getPort() + "]");
     Locator locator2 = lsRule.startLocatorVM(2, locatorProps);
@@ -116,6 +117,7 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
         "import cluster-configuration --zip-file-name=" + EXPORTED_CLUSTER_CONFIG_PATH);
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
+    CONFIG_FROM_ZIP.verify(locator);
     REPLICATED_CONFIG_FROM_ZIP.verify(locator1);
     REPLICATED_CONFIG_FROM_ZIP.verify(locator2);
   }
@@ -136,6 +138,8 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
     Path exportedZipPath = lsRule.getTempFolder().getRoot().toPath().resolve("exportedCC.zip");
     result = gfshConnector
         .executeCommand("export cluster-configuration --zip-file-name=" + exportedZipPath);
+    System.out.println(result.getContent());
+
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
     File exportedZip = exportedZipPath.toFile();

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
index 2e733a7..b310c50 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
@@ -245,11 +245,9 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase {
       } catch (IOException e) {
         fail("Unable to create a locator with a shared configuration", e);
       }
-
-      return null;
     });
 
-    dataMemberVm.invoke(() -> {
+    XmlEntity xmlEntity = dataMemberVm.invoke(() -> {
       Properties localProps = new Properties();
       localProps.setProperty(MCAST_PORT, "0");
       localProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
@@ -269,13 +267,13 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase {
 
       RegionFactory regionFactory = getCache().createRegionFactory(RegionShortcut.REPLICATE);
       regionFactory.create(REGION1);
+      return new XmlEntity(CacheXml.REGION, "name", REGION1);
+    });
 
-      XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", REGION1);
-      final SharedConfigurationWriter scw = new SharedConfigurationWriter();
-      assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
+    locator1Vm.invoke(() -> {
+      SharedConfiguration sc = InternalLocator.getLocator().getSharedConfiguration();
+      sc.addXmlEntity(xmlEntity, new String[] {testGroup});
 
-      xmlEntity = new XmlEntity(CacheXml.DISK_STORE, "name", DISKSTORENAME);
-      assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
       // Modify property and cache attributes
       Properties clusterProperties = new Properties();
       clusterProperties.setProperty(LOG_LEVEL, clusterLogLevel);
@@ -283,22 +281,21 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase {
       Map<String, String> cacheAttributes = new HashMap<String, String>();
       cacheAttributes.put(CacheXml.COPY_ON_READ, "true");
 
-      assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity, null));
+      sc.modifyXmlAndProperties(clusterProperties, cacheEntity, null);
 
       clusterProperties.setProperty(LOG_LEVEL, groupLogLevel);
-      assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity,
-          new String[] {testGroup}));
+      sc.modifyXmlAndProperties(clusterProperties, cacheEntity, new String[] {testGroup});
 
       // Add a jar
       byte[][] jarBytes = new byte[1][];
       jarBytes[0] = "Hello".getBytes();
-      assertTrue(scw.addJars(new String[] {"foo.jar"}, jarBytes, null));
+      assertTrue(sc.addJarsToThisLocator(new String[] {"foo.jar"}, jarBytes, null));
 
       // Add a jar for the group
       jarBytes = new byte[1][];
       jarBytes[0] = "Hello".getBytes();
-      assertTrue(scw.addJars(new String[] {"bar.jar"}, jarBytes, new String[] {testGroup}));
-      return null;
+      assertTrue(
+          sc.addJarsToThisLocator(new String[] {"bar.jar"}, jarBytes, new String[] {testGroup}));
     });
 
     final int locator2Port = ports[1];
@@ -363,16 +360,13 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase {
       assertNotNull(jarNames);
       assertNotNull(jarBytes);
 
-      return null;
+      sharedConfig.deleteXmlEntity(new XmlEntity(CacheXml.REGION, "name", REGION1),
+          new String[] {testGroup});
+      sharedConfig.removeJars(new String[] {"foo.jar"}, null);
+      sharedConfig.removeJars(null, null);
     });
 
     dataMemberVm.invoke(() -> {
-      SharedConfigurationWriter scw = new SharedConfigurationWriter();
-      scw.deleteXmlEntity(new XmlEntity(CacheXml.REGION, "name", REGION1),
-          new String[] {testGroup});
-      scw.deleteJars(new String[] {"foo.jar"}, null);
-      scw.deleteJars(null, null);
-
       Set<String> groups = new HashSet<String>();
       groups.add(testGroup);
       ConfigurationRequest configRequest = new ConfigurationRequest(groups);

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsJUnitTest.java
index 3992146..c5bdf07 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsJUnitTest.java
@@ -28,6 +28,8 @@ import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPathExpressionException;
 
+import org.apache.commons.io.IOUtils;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.w3c.dom.Document;
@@ -236,4 +238,20 @@ public class XmlUtilsJUnitTest {
     assertEquals(ns2, root.getElementsByTagName("childWithNamespace").item(0).getNamespaceURI());
   }
 
+  @Test
+  public void testCreateAndUpgradeDocumentFromXml() throws Exception {
+    Document doc = XmlUtils.createAndUpgradeDocumentFromXml(
+        IOUtils.toString(this.getClass().getResourceAsStream("SharedConfigurationJUnitTest.xml")));
+
+    String schemaLocation = XmlUtils.getAttribute(doc.getDocumentElement(),
+        W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION, W3C_XML_SCHEMA_INSTANCE_NS_URI);
+
+    assertNotNull(schemaLocation);
+    assertEquals(CacheXml.GEODE_NAMESPACE + " " + CacheXml.LATEST_SCHEMA_LOCATION, schemaLocation);
+
+    assertEquals(CacheXml.VERSION_LATEST,
+        XmlUtils.getAttribute(doc.getDocumentElement(), "version"));
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
index 2d4a929..aaa7724 100755
--- a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
@@ -14,28 +14,28 @@
  */
 package org.apache.geode.redis;
 
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.GemFireCache;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import redis.clients.jedis.Jedis;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Random;
 import java.util.Set;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import redis.clients.jedis.Jedis;
 
 @Category(IntegrationTest.class)
 public class SetsJUnitTest {

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 9e46ad0..718c816 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.test.dunit.rules;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.jayway.awaitility.Awaitility;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.CliUtil;
@@ -130,6 +132,13 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
     return (CommandResult) gfsh.getResult();
   }
 
+  public CommandResult executeAndVerifyCommand(String command) throws Exception {
+    CommandResult result = executeCommand(command);
+    assertThat(result.getStatus()).describedAs(result.getContent().toString())
+        .isEqualTo(Result.Status.OK);
+    return result;
+  }
+
   public boolean isConnected() {
     return connected;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerConfigurationRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerConfigurationRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerConfigurationRule.java
new file mode 100644
index 0000000..bbca60c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerConfigurationRule.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * 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.test.dunit.rules;
+
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.test.dunit.Host.*;
+import static org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.rules.ExternalResource;
+
+import org.apache.geode.distributed.Locator;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+
+
+public class LocatorServerConfigurationRule extends ExternalResource implements Serializable {
+
+  private int locatorPort = 0;
+
+  private boolean locatorInitialized = false;
+
+  private JUnit4DistributedTestCase testCase;
+
+  public LocatorServerConfigurationRule(JUnit4DistributedTestCase testCase) {
+    this.testCase = testCase;
+  }
+
+  Host host = getHost(0);
+  VM locator = host.getVM(0);
+
+  @Override
+  protected void before() {
+    // Add initialization requirement if any.
+    disconnectAllFromDS();
+  }
+
+  @Override
+  protected void after() {
+    disconnectAllFromDS();
+  }
+
+  /**
+   * Returns getHost(0).getVM(0) as a locator instance with the given configuration properties.
+   * 
+   * @param locatorProperties
+   *
+   * @return VM locator vm
+   *
+   * @throws IOException
+   */
+  public VM getLocatorVM(Properties locatorProperties) throws IOException {
+    if (!locatorProperties.containsKey(MCAST_PORT)) {
+      locatorProperties.setProperty(MCAST_PORT, "0");
+    }
+
+    locatorPort = locator.invoke(() -> {
+      InternalLocator locator =
+          (InternalLocator) Locator.startLocatorAndDS(0, null, locatorProperties);
+      locator.resetInternalLocatorFileNamesWithCorrectPortNumber(locatorPort);
+
+      if (locator.getConfig().getEnableClusterConfiguration()) {
+        Awaitility.await().atMost(65, TimeUnit.SECONDS)
+            .until(() -> assertTrue(locator.isSharedConfigurationRunning()));
+      }
+      return locator.getPort();
+    });
+
+    this.locatorInitialized = true;
+    return locator;
+  }
+
+  /**
+   * Returns a node VM with given configuration properties.
+   * 
+   * @param index valid 1 to 3 (returns getHist(0).getVM(index)
+   * @param properties
+   *
+   * @return VM node vm
+   */
+  public VM getServerVM(int index, Properties properties) {
+    assertTrue("Locator not initialized. Initialize locator by calling getLocatorVM()",
+        this.locatorInitialized);
+    assertTrue("VM with index 0 is used for locator service.", (index != 0));
+    VM nodeVM = getNodeVM(index);
+    nodeVM.invoke(() -> {
+      getSystem(properties);
+    });
+    return nodeVM;
+  }
+
+  /**
+   * this will simply returns the node
+   * 
+   * @param index
+   * @return
+   */
+  public VM getNodeVM(int index) {
+    return host.getVM(index);
+  }
+
+  public InternalDistributedSystem getSystem(Properties properties) {
+    if (!properties.containsKey(MCAST_PORT)) {
+      properties.setProperty(MCAST_PORT, "0");
+    }
+    properties.setProperty(LOCATORS, getHostName() + "[" + locatorPort + "]");
+    InternalDistributedSystem ds = testCase.getSystem(properties);
+    if (testCase instanceof JUnit4CacheTestCase) {
+      ((JUnit4CacheTestCase) testCase).getCache();
+    }
+    return ds;
+  }
+
+  public int getLocatorPort() {
+    return locatorPort;
+  }
+
+  private String getHostName() {
+    try {
+      return InetAddress.getLocalHost().getHostName();
+    } catch (UnknownHostException ignore) {
+      return "localhost";
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index 04fad5d..300d75a 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -97,6 +97,10 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     return locator;
   }
 
+  public Locator startLocatorVM(int index) throws IOException {
+    return startLocatorVM(index, new Properties());
+  }
+
   /**
    * starts a cache server that does not connect to a locator
    * 
@@ -106,6 +110,10 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     return startServerVM(index, properties, 0);
   }
 
+  public Server startServerVM(int index, int locatorPort) throws IOException {
+    return startServerVM(index, new Properties(), locatorPort);
+  }
+
   /**
    * Starts a cache server that connect to the locator running at the given port.
    */

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/resources/org/apache/geode/distributed/internal/SharedConfigurationJUnitTest.xml
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/distributed/internal/SharedConfigurationJUnitTest.xml b/geode-core/src/test/resources/org/apache/geode/distributed/internal/SharedConfigurationJUnitTest.xml
deleted file mode 100644
index 68ce00f..0000000
--- a/geode-core/src/test/resources/org/apache/geode/distributed/internal/SharedConfigurationJUnitTest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License 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.
--->
-
-<!DOCTYPE cache PUBLIC
-    "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
-    "http://www.gemstone.com/dtd/cache8_0.dtd">
-<cache>
-</cache>

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/utils/SharedConfigurationJUnitTest.xml
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/utils/SharedConfigurationJUnitTest.xml b/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/utils/SharedConfigurationJUnitTest.xml
new file mode 100644
index 0000000..68ce00f
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/configuration/utils/SharedConfigurationJUnitTest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License 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.
+-->
+
+<!DOCTYPE cache PUBLIC
+    "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
+    "http://www.gemstone.com/dtd/cache8_0.dtd">
+<cache>
+</cache>

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
deleted file mode 100644
index f73a393..0000000
--- a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
+++ /dev/null
@@ -1,1055 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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.management.internal.configuration;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
-import org.apache.geode.cache.query.Index;
-import org.apache.geode.cache.wan.GatewayReceiver;
-import org.apache.geode.cache.wan.GatewaySender;
-import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
-import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.internal.ClassBuilder;
-import org.apache.geode.internal.JarClassLoader;
-import org.apache.geode.internal.JarDeployer;
-import org.apache.geode.internal.admin.remote.ShutdownAllRequest;
-import org.apache.geode.internal.cache.DiskStoreImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.extension.Extensible;
-import org.apache.geode.internal.cache.extension.Extension;
-import org.apache.geode.internal.cache.extension.mock.MockCacheExtension;
-import org.apache.geode.internal.cache.extension.mock.MockExtensionCommands;
-import org.apache.geode.internal.cache.extension.mock.MockRegionExtension;
-import org.apache.geode.internal.cache.xmlcache.XmlGenerator;
-import org.apache.geode.internal.cache.xmlcache.XmlParser;
-import org.apache.geode.management.cli.Result.Status;
-import org.apache.geode.management.internal.cli.HeadlessGfsh;
-import org.apache.geode.management.internal.cli.commands.CliCommandTestBase;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-import org.apache.geode.test.dunit.SerializableCallable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.WaitCriterion;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.*;
-import java.util.Map.Entry;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.internal.FileUtil.delete;
-import static org.apache.geode.internal.FileUtil.deleteMatching;
-import static org.apache.geode.internal.lang.StringUtils.isBlank;
-import static org.apache.geode.management.internal.cli.CliUtil.getAllNormalMembers;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.Host.getHost;
-import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
-import static org.apache.geode.test.dunit.Wait.waitForCriterion;
-import static org.apache.commons.io.FileUtils.*;
-
-@Category(DistributedTest.class)
-public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
-
-  private static final int TIMEOUT = 10000;
-  private static final int INTERVAL = 500;
-
-  private static final String REPLICATE_REGION = "ReplicateRegion1";
-  private static final String PARTITION_REGION = "PartitionRegion1";
-  private static final String DISK_REGION1 = "DR1";
-  private static final String INDEX1 = "ID1";
-  private static final String INDEX2 = "ID2";
-  private static final String GROUP1 = "G1";
-  private static final String GROUP2 = "G2";
-  private static final String JAR1 = "D1.jar";
-  private static final String JAR2 = "D2.jar";
-  private static final String JAR3 = "D3.jar";
-  private static final String AsyncEventQueue1 = "Q1";
-
-  private static final String dataMember = "DataMember";
-  private static final String newMember = "NewMember";
-
-  private static Set<String> serverNames = new HashSet<>();
-  private static Set<String> jarFileNames = new HashSet<>();
-
-  private transient ClassBuilder classBuilder = new ClassBuilder();
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    disconnectAllFromDS();
-  }
-
-  @Override
-  public final void preTearDownCliCommandTestBase() throws Exception {
-    shutdownAll();
-
-    serverNames.clear();
-    jarFileNames.clear();
-  }
-
-  @Category(FlakyTest.class) // GEODE-1335
-  @Test
-  public void testConfigDistribution() throws Exception {
-    addIgnoredException("could not get remote locator");
-    addIgnoredException("EntryDestroyedException");
-
-    String workingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator;
-
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    String gatewayReceiverStartPort = "10000";
-    String gatewayReceiverEndPort = "20000";
-    final String gsId = "GatewaySender1";
-    final String batchSize = "1000";
-    final String dispatcherThreads = "5";
-    final String enableConflation = "false";
-    final String manualStart = "false";
-    final String receiverManualStart = "true";
-    final String alertThreshold = "1000";
-    final String batchTimeInterval = "20";
-    final String maxQueueMemory = "100";
-    final String orderPolicy = OrderPolicy.KEY.toString();
-    final String parallel = "true";
-    final String rmDsId = "250";
-    final String socketBufferSize =
-        String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000);
-    final String socketReadTimeout =
-        String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 200);
-    final String DESTROY_REGION = "regionToBeDestroyed";
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createRegion(PARTITION_REGION, RegionShortcut.PARTITION, null);
-    createRegion(DESTROY_REGION, RegionShortcut.REPLICATE, null);
-    createIndex(INDEX1, "AAPL", REPLICATE_REGION, null);
-    createIndex(INDEX2, "VMW", PARTITION_REGION, null);
-
-    createAndDeployJar(workingDir + JAR1, null);
-    createAndDeployJar(workingDir + JAR2, null);
-    createAndDeployJar(workingDir + JAR3, null);
-
-    createAsyncEventQueue(AsyncEventQueue1, "false", null, "1000", "1000", null);
-    destroyRegion(DESTROY_REGION);
-    destroyIndex(INDEX2, PARTITION_REGION, null);
-
-    undeployJar(JAR3, null);
-
-    alterRuntime("true", "", "", "");
-    createGatewayReceiver(receiverManualStart, "", gatewayReceiverStartPort, gatewayReceiverEndPort,
-        "20", "");
-    createGatewaySender(gsId, batchSize, alertThreshold, batchTimeInterval, dispatcherThreads,
-        enableConflation, manualStart, maxQueueMemory, orderPolicy, parallel, rmDsId,
-        socketBufferSize, socketReadTimeout);
-
-    // alterRegion(PARTITION_REGION, "false", AsyncEventQueue1, "", "", "", "", "", "", gsId);
-    // Start a new member which receives the shared configuration
-    // Verify the config creation on this member
-
-    final String newMemberWorkingDir =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-        assertTrue(cache.getCopyOnRead());
-
-        Region region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-        Region region2 = cache.getRegion(PARTITION_REGION);
-        assertNotNull(region2);
-
-        Region region3 = cache.getRegion(DESTROY_REGION);
-        assertNull(region3);
-
-        // Index verification
-        Index index1 = cache.getQueryService().getIndex(region1, INDEX1);
-        assertNotNull(index1);
-        assertNull(cache.getQueryService().getIndex(region2, INDEX2));
-
-        final JarDeployer jarDeployer = new JarDeployer(
-            ((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
-
-        final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
-
-        Set<String> jarNames = new HashSet<String>();
-
-        for (JarClassLoader jarClassLoader : jarClassLoaders) {
-          jarNames.add(jarClassLoader.getJarName());
-        }
-
-        assertTrue(jarNames.contains(JAR1));
-        assertTrue(jarNames.contains(JAR2));
-        assertFalse(jarNames.contains(JAR3));
-
-        // ASYNC-EVENT-QUEUE verification
-        AsyncEventQueue aeq = cache.getAsyncEventQueue(AsyncEventQueue1);
-        assertNotNull(aeq);
-        assertFalse(aeq.isPersistent());
-        assertTrue(aeq.getBatchSize() == 1000);
-        assertTrue(aeq.getMaximumQueueMemory() == 1000);
-
-        // GatewayReceiver verification
-        Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-        assertFalse(gatewayReceivers.isEmpty());
-        assertTrue(gatewayReceivers.size() == 1);
-
-        // Gateway Sender verification
-        GatewaySender gs = cache.getGatewaySender(gsId);
-        assertNotNull(gs);
-        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
-        assertTrue(batchSize.equals(Integer.toString(gs.getBatchSize())));
-        assertTrue(dispatcherThreads.equals(Integer.toString(gs.getDispatcherThreads())));
-        assertTrue(enableConflation.equals(Boolean.toString(gs.isBatchConflationEnabled())));
-        assertTrue(manualStart.equals(Boolean.toString(gs.isManualStart())));
-        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
-        assertTrue(batchTimeInterval.equals(Integer.toString(gs.getBatchTimeInterval())));
-        assertTrue(maxQueueMemory.equals(Integer.toString(gs.getMaximumQueueMemory())));
-        assertTrue(orderPolicy.equals(gs.getOrderPolicy().toString()));
-        assertTrue(parallel.equals(Boolean.toString(gs.isParallel())));
-        assertTrue(rmDsId.equals(Integer.toString(gs.getRemoteDSId())));
-        assertTrue(socketBufferSize.equals(Integer.toString(gs.getSocketBufferSize())));
-        assertTrue(socketReadTimeout.equals(Integer.toString(gs.getSocketReadTimeout())));
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  /**
-   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
-   * {@link XmlEntity} as it applies to Extensions. Asserts that Mock Extension is created and
-   * altered on region and cache.
-   * 
-   * @since GemFire 8.1
-   */
-  @Category(FlakyTest.class) // GEODE-1334
-  @Test
-  public void testCreateExtensions() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createMockRegionExtension(REPLICATE_REGION, "value1");
-    alterMockRegionExtension(REPLICATE_REGION, "value2");
-    createMockCacheExtension("value1");
-    alterMockCacheExtension("value2");
-
-    // Start a new member which receives the shared configuration
-    // Verify the config creation on this member
-
-    final String newMemberWorkDir =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-
-        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-
-        // MockRegionExtension verification
-        @SuppressWarnings("unchecked")
-        // should only be one region extension
-        final MockRegionExtension mockRegionExtension =
-            (MockRegionExtension) ((Extensible<Region<?, ?>>) region1).getExtensionPoint()
-                .getExtensions().iterator().next();
-        assertNotNull(mockRegionExtension);
-        assertEquals(1, mockRegionExtension.beforeCreateCounter.get());
-        assertEquals(1, mockRegionExtension.onCreateCounter.get());
-        assertEquals("value2", mockRegionExtension.getValue());
-
-        // MockCacheExtension verification
-        @SuppressWarnings("unchecked")
-        // should only be one cache extension
-        final MockCacheExtension mockCacheExtension =
-            (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions()
-                .iterator().next();
-        assertNotNull(mockCacheExtension);
-        assertEquals(1, mockCacheExtension.beforeCreateCounter.get());
-        assertEquals(1, mockCacheExtension.onCreateCounter.get());
-        assertEquals("value2", mockCacheExtension.getValue());
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  /**
-   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
-   * {@link XmlEntity} as it applies to Extensions. Asserts that Mock Extension is created and
-   * destroyed on region and cache.
-   * 
-   * @since GemFire 8.1
-   */
-  @Category(FlakyTest.class) // GEODE-1333
-  @Test
-  public void testDestroyExtensions() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createMockRegionExtension(REPLICATE_REGION, "value1");
-    destroyMockRegionExtension(REPLICATE_REGION);
-    createMockCacheExtension("value1");
-    destroyMockCacheExtension();
-
-    // Start a new member which receives the shared configuration
-    // Verify the config creation on this member
-
-    final String newMemberWorkingDir =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-
-        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-
-        // MockRegionExtension verification
-        @SuppressWarnings("unchecked")
-        final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?, ?>>) region1;
-        // Should not be any region extensions
-        assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
-
-        // MockCacheExtension verification
-        @SuppressWarnings("unchecked")
-        final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
-        // Should not be any cache extensions
-        assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  @Ignore("disabled for unknown reason") // this passes when @Ignore is removed
-  @Test
-  public void testCreateDiskStore() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    final String diskStoreName = "clusterConfigTestDiskStore";
-    final String diskDirs = "dir1";
-
-    // final String
-    // createPersistentRegion(peersRegion, RegionShortcut.PARTITION_PERSISTENT, "", diskStoreName);
-
-    final String autoCompact = "true";
-    final String allowForceCompaction = "true";
-    final String compactionThreshold = "50";
-    final String duCritical = "90";
-    final String duWarning = "85";
-    final String maxOplogSize = "1000";
-    final String queueSize = "300";
-    final String timeInterval = "10";
-    final String writeBufferSize = "100";
-
-    createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold,
-        duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
-
-    // createAsyncEventQueue(id, persistent, diskStoreName, batchSize, maxQueueMemory, group)
-
-    // Stop the existing data member
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-
-        CacheFactory cf = new CacheFactory();
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        File[] diskDirs = null;
-        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
-        assertFalse(diskStoreList.isEmpty());
-        assertTrue(diskStoreList.size() == 1);
-
-        for (DiskStoreImpl diskStore : diskStoreList) {
-          diskDirs = diskStore.getDiskDirs();
-          break;
-        }
-
-        assertNotNull(diskDirs);
-        assertTrue(diskDirs.length > 0);
-
-        // close the cache
-        cache.close();
-
-        // Delete the disk-store files
-        for (File diskDir : diskDirs) {
-          deleteDirectory(diskDir);
-        }
-        return getAllNormalMembers(cache);
-      }
-    });
-
-    final String newMemberWorkingDir =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    // Now start the new data member and it should create all the disk-store artifacts
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        assertNotNull(cache);
-
-
-        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
-        assertFalse(diskStoreList.isEmpty());
-        assertTrue(diskStoreList.size() == 1);
-
-        for (DiskStoreImpl diskStore : diskStoreList) {
-          assertTrue(diskStore.getName().equals(diskStoreName));
-          assertTrue(Boolean.toString(diskStore.getAutoCompact()).equals(autoCompact));
-          assertTrue(
-              Boolean.toString(diskStore.getAllowForceCompaction()).equals(allowForceCompaction));
-          assertTrue(
-              Integer.toString(diskStore.getCompactionThreshold()).equals(compactionThreshold));
-          assertTrue(Long.toString(diskStore.getMaxOplogSize()).equals(maxOplogSize));
-          assertTrue(Integer.toString(diskStore.getQueueSize()).equals(queueSize));
-          assertTrue(Integer.toString(diskStore.getWriteBufferSize()).equals(writeBufferSize));
-          assertTrue(Long.toString(diskStore.getTimeInterval()).equals(timeInterval));
-          break;
-        }
-        cache.close();
-        return null;
-      }
-    });
-  }
-
-  @Ignore("disabled for unknown reason") // this fails in configurePDX when @Ignore is removed
-  @Test
-  public void testConfigurePDX() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    configurePDX("com.foo.*", "true", "true", null, "true");
-
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        assertTrue(cache.getPdxReadSerialized());
-        assertTrue(cache.getPdxIgnoreUnreadFields());
-        assertTrue(cache.getPdxPersistent());
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void testClusterConfigDir() throws Exception {
-    final int[] ports = getRandomAvailableTCPPorts(3);
-    final int locator1Port = ports[0];
-    final String locator1Name = "locator1-" + locator1Port;
-
-    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator
-        + "locator-" + locator1Port + ".log";
-    final String clusterConfigPath =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "userSpecifiedDir";
-
-    VM locatorAndMgr = getHost(0).getVM(3);
-    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        int httpPort;
-        int jmxPort;
-        String jmxHost;
-
-        try {
-          jmxHost = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException ignore) {
-          jmxHost = "localhost";
-        }
-
-        final int[] ports = getRandomAvailableTCPPorts(2);
-
-        jmxPort = ports[0];
-        httpPort = ports[1];
-
-        final File locatorLogFile = new File(locatorLogPath);
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator1Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "config");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-        locatorProps.setProperty(JMX_MANAGER, "true");
-        locatorProps.setProperty(JMX_MANAGER_START, "true");
-        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
-        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-
-        File clusterConfigDir = new File(clusterConfigPath);
-        assertTrue(clusterConfigDir.mkdir());
-
-        locatorProps.setProperty(CLUSTER_CONFIGURATION_DIR, clusterConfigDir.getCanonicalPath());
-        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-
-        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
-            locatorLogFile, null, locatorProps);
-
-        WaitCriterion wc = new WaitCriterion() {
-          @Override
-          public boolean done() {
-            return locator.isSharedConfigurationRunning();
-          }
-
-          @Override
-          public String description() {
-            return "Waiting for shared configuration to be started";
-          }
-        };
-        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        assertTrue(clusterConfigDir.list().length > 0);
-
-        final Object[] result = new Object[4];
-        result[0] = locator1Port;
-        result[1] = jmxHost;
-        result[2] = jmxPort;
-        result[3] = httpPort;
-        return result;
-      }
-    });
-  }
-
-  @Test
-  public void testConfigurePDXForWarning() throws Exception {
-    setup();
-    CommandResult commandResult = configurePDX("com.foo.*", "true", "true", null, "true");
-    String result = (String) commandResult.getResultData().getGfJsonObject()
-        .getJSONObject("content").getJSONArray("message").get(0);
-    assertEquals(CliStrings.CONFIGURE_PDX__NORMAL__MEMBERS__WARNING, result);
-  }
-
-  private Object[] setup() throws IOException {
-    final int[] ports = getRandomAvailableTCPPorts(3);
-    final int locator1Port = ports[0];
-    final String locator1Name = "locator1-" + locator1Port;
-    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator
-        + "locator-" + locator1Port + ".log";
-
-    VM locatorAndMgr = getHost(0).getVM(3);
-    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        int httpPort;
-        int jmxPort;
-        String jmxHost;
-
-        try {
-          jmxHost = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException ignore) {
-          jmxHost = "localhost";
-        }
-
-        final int[] ports = getRandomAvailableTCPPorts(2);
-
-        jmxPort = ports[0];
-        httpPort = ports[1];
-
-        final File locatorLogFile = new File(locatorLogPath);
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator1Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "config");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-        locatorProps.setProperty(JMX_MANAGER, "true");
-        locatorProps.setProperty(JMX_MANAGER_START, "true");
-        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
-        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-
-        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
-            locatorLogFile, null, locatorProps);
-
-        WaitCriterion wc = new WaitCriterion() {
-          @Override
-          public boolean done() {
-            return locator.isSharedConfigurationRunning();
-          }
-
-          @Override
-          public String description() {
-            return "Waiting for shared configuration to be started";
-          }
-        };
-        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        final Object[] result = new Object[4];
-        result[0] = locator1Port;
-        result[1] = jmxHost;
-        result[2] = jmxPort;
-        result[3] = httpPort;
-        return result;
-      }
-    });
-
-    HeadlessGfsh gfsh = getDefaultShell();
-    String jmxHost = (String) result[1];
-    int jmxPort = (Integer) result[2];
-    int httpPort = (Integer) result[3];
-
-    connect(jmxHost, jmxPort, httpPort, gfsh);
-
-    final String dataMemberWorkingDir =
-        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
-
-    // Create a cache in VM 1
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-        File workingDir = new File(dataMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.dataMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-        assertNotNull(cache);
-        return getAllNormalMembers(cache);
-      }
-    });
-
-    return result;
-  }
-
-  private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
-    csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
-    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createMockRegionExtension(final String regionName, final String value) {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void alterMockRegionExtension(final String regionName, final String value) {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void destroyMockRegionExtension(final String regionName) {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createMockCacheExtension(final String value) {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_CACHE_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void alterMockCacheExtension(final String value) {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_CACHE_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void destroyMockCacheExtension() {
-    CommandStringBuilder csb =
-        new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_CACHE_EXTENSION);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createPersistentRegion(String regionName, RegionShortcut regionShortCut,
-      String group, String diskStoreName) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGION, regionName);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__DISKSTORE, diskStoreName);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void destroyRegion(String regionName) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_REGION);
-    csb.addOption(CliStrings.DESTROY_REGION__REGION, regionName);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void alterRegion(String regionName, String cloningEnabled, String aeqId,
-      String cacheListener, String cacheWriter, String cacheLoader, String entryExpIdleTime,
-      String entryExpIdleTimeAction, String evictionMax, String gsId) {
-
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_REGION);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, "false");
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, aeqId);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELISTENER, cacheListener);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHEWRITER, cacheWriter);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELOADER, cacheLoader);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, cloningEnabled);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME, entryExpIdleTime);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION,
-        entryExpIdleTimeAction);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__EVICTIONMAX, evictionMax);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__GATEWAYSENDERID, gsId);
-
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private CommandResult executeAndVerifyCommand(String commandString) {
-    CommandResult cmdResult = executeCommand(commandString);
-    org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("Command : " + commandString);
-    org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
-        .info("Command Result : " + commandResultToString(cmdResult));
-    assertEquals(Status.OK, cmdResult.getStatus());
-    assertFalse(cmdResult.failedToPersist());
-    return cmdResult;
-  }
-
-  private void createIndex(String indexName, String expression, String regionName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
-    csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
-    csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
-    csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void destroyIndex(String indexName, String regionName, String group) {
-    if (isBlank(indexName) && isBlank(regionName) && isBlank(group)) {
-      return;
-    }
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__NAME, indexName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__REGION, regionName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__GROUP, group);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void createDiskStore(String diskStoreName, String diskDirs, String autoCompact,
-      String allowForceCompaction, String compactionThreshold, String duCritical, String duWarning,
-      String maxOplogSize, String queueSize, String timeInterval, String writeBufferSize) {
-
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
-    csb.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreName);
-    csb.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, diskDirs);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, autoCompact);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION,
-        allowForceCompaction);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD,
-        compactionThreshold);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, duCritical);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, duWarning);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, maxOplogSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, queueSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, timeInterval);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, writeBufferSize);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void destroyDiskStore(String diskStoreName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
-    csb.addOption(CliStrings.DESTROY_DISK_STORE__NAME, diskStoreName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_DISK_STORE__GROUP, group);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createGatewayReceiver(String manualStart, String bindAddress, String startPort,
-      String endPort, String maxTimeBetweenPings, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYRECEIVER);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART, manualStart);
-    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT, startPort);
-    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT, endPort);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS, bindAddress);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__GROUP, group);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS,
-        maxTimeBetweenPings);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void createGatewaySender(String id, String batchSize, String alertThreshold,
-      String batchTimeInterval, String dispatcherThreads, String enableConflation,
-      String manualStart, String maxQueueMemory, String orderPolicy, String parallel, String rmDsId,
-      String socketBufferSize, String socketReadTimeout) {
-
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYSENDER);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ID, id);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE, batchSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD, alertThreshold);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL,
-        batchTimeInterval);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS,
-        dispatcherThreads);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION,
-        enableConflation);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MANUALSTART, manualStart);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY, maxQueueMemory);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY, orderPolicy);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__PARALLEL, parallel);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID, rmDsId);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE,
-        socketBufferSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT,
-        socketReadTimeout);
-
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void createAsyncEventQueue(String id, String persistent, String diskStoreName,
-      String batchSize, String maxQueueMemory, String group) throws IOException {
-    String queueCommandsJarName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator
-        + "testEndToEndSC-QueueCommands.jar";
-    final File jarFile = new File(queueCommandsJarName);
-
-    try {
-      ClassBuilder classBuilder = new ClassBuilder();
-      byte[] jarBytes =
-          classBuilder.createJarFromClassContent("com/qcdunit/QueueCommandsDUnitTestListener",
-              "package com.qcdunit;" + "import java.util.List; import java.util.Properties;"
-                  + "import org.apache.geode.internal.cache.xmlcache.Declarable2; import org.apache.geode.cache.asyncqueue.AsyncEvent;"
-                  + "import org.apache.geode.cache.asyncqueue.AsyncEventListener;"
-                  + "public class QueueCommandsDUnitTestListener implements Declarable2, AsyncEventListener {"
-                  + "Properties props;"
-                  + "public boolean processEvents(List<AsyncEvent> events) { return true; }"
-                  + "public void close() {}"
-                  + "public void init(final Properties props) {this.props = props;}"
-                  + "public Properties getConfig() {return this.props;}}");
-
-      writeByteArrayToFile(jarFile, jarBytes);
-      CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
-      csb.addOption(CliStrings.DEPLOY__JAR, queueCommandsJarName);
-      executeAndVerifyCommand(csb.getCommandString());
-
-      csb = new CommandStringBuilder(CliStrings.CREATE_ASYNC_EVENT_QUEUE);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__ID, id);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER,
-          "com.qcdunit.QueueCommandsDUnitTestListener");
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISK_STORE, diskStoreName);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__BATCH_SIZE, batchSize);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GROUP, group);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PERSISTENT, persistent);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY,
-          maxQueueMemory);
-      executeAndVerifyCommand(csb.getCommandString());
-
-    } finally {
-      deleteQuietly(jarFile);
-    }
-  }
-
-  private CommandResult configurePDX(String autoSerializerClasses, String ignoreUnreadFields,
-      String persistent, String portableAutoSerializerClasses, String readSerialized) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CONFIGURE_PDX);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES,
-        autoSerializerClasses);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__IGNORE__UNREAD_FIELDS,
-        ignoreUnreadFields);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PERSISTENT, persistent);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PORTABLE__AUTO__SERIALIZER__CLASSES,
-        portableAutoSerializerClasses);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__READ__SERIALIZED, readSerialized);
-
-    return executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void createAndDeployJar(String jarName, String group) throws IOException {
-    File newDeployableJarFile = new File(jarName);
-    this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
-    csb.addOption(CliStrings.DEPLOY__JAR, jarName);
-    if (!isBlank(group)) {
-      csb.addOption(CliStrings.DEPLOY__GROUP, group);
-    }
-    executeAndVerifyCommand(csb.getCommandString());
-    jarFileNames.add(jarName);
-  }
-
-  private void undeployJar(String jarName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.UNDEPLOY);
-    if (!isBlank(jarName)) {
-      csb.addOption(CliStrings.UNDEPLOY__JAR, jarName);
-    }
-    if (!isBlank(group)) {
-      csb.addOption(CliStrings.UNDEPLOY__GROUP, group);
-    }
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void alterRuntime(String copyOnRead, String lockLease, String lockTimeout,
-      String messageSyncInterval) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ, copyOnRead);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE, lockLease);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT, lockTimeout);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL,
-        messageSyncInterval);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void deleteSavedJarFiles() throws IOException {
-    deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
-    delete(new File("Deploy1.jar"));
-  }
-
-  private void shutdownAll() throws IOException {
-    VM locatorAndMgr = getHost(0).getVM(3);
-    locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
-        ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
-        return null;
-      }
-    });
-
-    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
-    // Clean up the directories
-    if (serverNames != null && !serverNames.isEmpty()) {
-      for (String serverName : serverNames) {
-        final File serverDir = new File(serverName);
-        cleanDirectory(serverDir);
-        deleteDirectory(serverDir);
-      }
-    }
-  }
-
-  private static class CommandBuilder {
-
-    private CommandStringBuilder csb;
-
-    public CommandBuilder(String commandName, Map<String, String> options) {
-      csb = new CommandStringBuilder(commandName);
-
-      Set<Entry<String, String>> entries = options.entrySet();
-
-      Iterator<Entry<String, String>> iter = entries.iterator();
-
-      while (iter.hasNext()) {
-        Entry<String, String> entry = iter.next();
-        String option = entry.getKey();
-
-        if (isBlank(option)) {
-          csb.addOption(option, entry.getValue());
-        }
-      }
-    }
-
-    public String getCommandString() {
-      return csb.toString();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/602ac4f4/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationExtensionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationExtensionsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationExtensionsDUnitTest.java
new file mode 100644
index 0000000..f9786c7
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationExtensionsDUnitTest.java
@@ -0,0 +1,429 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * 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.management.internal.configuration;
+
+import static org.apache.commons.io.FileUtils.cleanDirectory;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.geode.distributed.ConfigurationProperties.DEPLOY_WORKING_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
+import static org.apache.geode.management.internal.cli.CliUtil.getAllNormalMembers;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Host.getHost;
+import static org.apache.geode.test.dunit.Wait.waitForCriterion;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.distributed.Locator;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.internal.admin.remote.ShutdownAllRequest;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.extension.Extensible;
+import org.apache.geode.internal.cache.extension.Extension;
+import org.apache.geode.internal.cache.extension.mock.MockCacheExtension;
+import org.apache.geode.internal.cache.extension.mock.MockExtensionCommands;
+import org.apache.geode.internal.cache.extension.mock.MockRegionExtension;
+import org.apache.geode.internal.cache.xmlcache.XmlGenerator;
+import org.apache.geode.internal.cache.xmlcache.XmlParser;
+import org.apache.geode.management.cli.Result.Status;
+import org.apache.geode.management.internal.cli.HeadlessGfsh;
+import org.apache.geode.management.internal.cli.commands.CliCommandTestBase;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.test.dunit.SerializableCallable;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.WaitCriterion;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+@Category(DistributedTest.class)
+public class ClusterConfigurationExtensionsDUnitTest extends CliCommandTestBase {
+
+  private static final int TIMEOUT = 10000;
+  private static final int INTERVAL = 500;
+
+  private static final String REPLICATE_REGION = "ReplicateRegion1";
+
+  private static final String dataMember = "DataMember";
+  private static final String newMember = "NewMember";
+
+  private static Set<String> serverNames = new HashSet<>();
+  private static Set<String> jarFileNames = new HashSet<>();
+
+  @Override
+  public final void postSetUpCliCommandTestBase() throws Exception {
+    disconnectAllFromDS();
+  }
+
+  @Override
+  public final void preTearDownCliCommandTestBase() throws Exception {
+    shutdownAll();
+
+    serverNames.clear();
+    jarFileNames.clear();
+  }
+
+  /**
+   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
+   * {@link XmlEntity} as it applies to Extensions. Asserts that Mock Extension is created and
+   * altered on region and cache.
+   * 
+   * @since GemFire 8.1
+   */
+  @Category(FlakyTest.class) // GEODE-1334
+  @Test
+  public void testCreateExtensions() throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+
+    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+    createMockRegionExtension(REPLICATE_REGION, "value1");
+    alterMockRegionExtension(REPLICATE_REGION, "value2");
+    createMockCacheExtension("value1");
+    alterMockCacheExtension("value2");
+
+    // Start a new member which receives the shared configuration
+    // Verify the config creation on this member
+
+    final String newMemberWorkDir =
+        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
+        localProps.setProperty(NAME, ClusterConfigurationExtensionsDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+
+        assertNotNull(cache);
+
+        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+        assertNotNull(region1);
+
+        // MockRegionExtension verification
+        @SuppressWarnings("unchecked")
+        // should only be one region extension
+        final MockRegionExtension mockRegionExtension =
+            (MockRegionExtension) ((Extensible<Region<?, ?>>) region1).getExtensionPoint()
+                .getExtensions().iterator().next();
+        assertNotNull(mockRegionExtension);
+        assertEquals(1, mockRegionExtension.beforeCreateCounter.get());
+        assertEquals(1, mockRegionExtension.onCreateCounter.get());
+        assertEquals("value2", mockRegionExtension.getValue());
+
+        // MockCacheExtension verification
+        @SuppressWarnings("unchecked")
+        // should only be one cache extension
+        final MockCacheExtension mockCacheExtension =
+            (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions()
+                .iterator().next();
+        assertNotNull(mockCacheExtension);
+        assertEquals(1, mockCacheExtension.beforeCreateCounter.get());
+        assertEquals(1, mockCacheExtension.onCreateCounter.get());
+        assertEquals("value2", mockCacheExtension.getValue());
+
+        return getAllNormalMembers(cache);
+      }
+    });
+  }
+
+  /**
+   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
+   * {@link XmlEntity} as it applies to Extensions. Asserts that Mock Extension is created and
+   * destroyed on region and cache.
+   * 
+   * @since GemFire 8.1
+   */
+  @Category(FlakyTest.class) // GEODE-1333
+  @Test
+  public void testDestroyExtensions() throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+
+    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+    createMockRegionExtension(REPLICATE_REGION, "value1");
+    destroyMockRegionExtension(REPLICATE_REGION);
+    createMockCacheExtension("value1");
+    destroyMockCacheExtension();
+
+    // Start a new member which receives the shared configuration
+    // Verify the config creation on this member
+
+    final String newMemberWorkingDir =
+        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
+        localProps.setProperty(NAME, ClusterConfigurationExtensionsDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+
+        assertNotNull(cache);
+
+        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+        assertNotNull(region1);
+
+        // MockRegionExtension verification
+        @SuppressWarnings("unchecked")
+        final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?, ?>>) region1;
+        // Should not be any region extensions
+        assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
+
+        // MockCacheExtension verification
+        @SuppressWarnings("unchecked")
+        final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
+        // Should not be any cache extensions
+        assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
+
+        return getAllNormalMembers(cache);
+      }
+    });
+  }
+
+  private Object[] setup() throws IOException {
+    final int[] ports = getRandomAvailableTCPPorts(3);
+    final int locator1Port = ports[0];
+    final String locator1Name = "locator1-" + locator1Port;
+    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator
+        + "locator-" + locator1Port + ".log";
+
+    VM locatorAndMgr = getHost(0).getVM(3);
+    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        int httpPort;
+        int jmxPort;
+        String jmxHost;
+
+        try {
+          jmxHost = InetAddress.getLocalHost().getHostName();
+        } catch (UnknownHostException ignore) {
+          jmxHost = "localhost";
+        }
+
+        final int[] ports = getRandomAvailableTCPPorts(2);
+
+        jmxPort = ports[0];
+        httpPort = ports[1];
+
+        final File locatorLogFile = new File(locatorLogPath);
+
+        final Properties locatorProps = new Properties();
+        locatorProps.setProperty(NAME, locator1Name);
+        locatorProps.setProperty(MCAST_PORT, "0");
+        locatorProps.setProperty(LOG_LEVEL, "config");
+        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+        locatorProps.setProperty(JMX_MANAGER, "true");
+        locatorProps.setProperty(JMX_MANAGER_START, "true");
+        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
+        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
+        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
+
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
+            locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+        final Object[] result = new Object[4];
+        result[0] = locator1Port;
+        result[1] = jmxHost;
+        result[2] = jmxPort;
+        result[3] = httpPort;
+        return result;
+      }
+    });
+
+    HeadlessGfsh gfsh = getDefaultShell();
+    String jmxHost = (String) result[1];
+    int jmxPort = (Integer) result[2];
+    int httpPort = (Integer) result[3];
+
+    connect(jmxHost, jmxPort, httpPort, gfsh);
+
+    final String dataMemberWorkingDir =
+        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
+
+    // Create a cache in VM 1
+    VM dataMember = getHost(0).getVM(1);
+    dataMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+        File workingDir = new File(dataMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
+        localProps.setProperty(NAME, ClusterConfigurationExtensionsDUnitTest.dataMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+        assertNotNull(cache);
+        return getAllNormalMembers(cache);
+      }
+    });
+
+    return result;
+  }
+
+  private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
+    csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
+    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createMockRegionExtension(final String regionName, final String value) {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void alterMockRegionExtension(final String regionName, final String value) {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void destroyMockRegionExtension(final String regionName) {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createMockCacheExtension(final String value) {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_CACHE_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void alterMockCacheExtension(final String value) {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_CACHE_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void destroyMockCacheExtension() {
+    CommandStringBuilder csb =
+        new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_CACHE_EXTENSION);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private CommandResult executeAndVerifyCommand(String commandString) {
+    CommandResult cmdResult = executeCommand(commandString);
+    org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("Command : " + commandString);
+    org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
+        .info("Command Result : " + commandResultToString(cmdResult));
+    assertEquals(Status.OK, cmdResult.getStatus());
+    assertFalse(cmdResult.failedToPersist());
+    return cmdResult;
+  }
+
+  private void shutdownAll() throws IOException {
+    VM locatorAndMgr = getHost(0).getVM(3);
+    locatorAndMgr.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws Exception {
+        GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
+        ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+        return null;
+      }
+    });
+
+    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
+    // Clean up the directories
+    if (serverNames != null && !serverNames.isEmpty()) {
+      for (String serverName : serverNames) {
+        final File serverDir = new File(serverName);
+        cleanDirectory(serverDir);
+        deleteDirectory(serverDir);
+      }
+    }
+  }
+}


Mime
View raw message